private boolean isQuorumAware(Operation op) { return op.getService() instanceof QuorumAwareService; }
public static void before(List<Operation> operationList, Operation wrapper) throws Exception { for (Operation operation : operationList) { operation.setService(wrapper.getService()); operation.setServiceName(wrapper.getServiceName()); operation.setCallerUuid(wrapper.getCallerUuid()); operation.setNodeEngine(wrapper.getNodeEngine()); operation.setPartitionId(wrapper.getPartitionId()); operation.beforeRun(); } }
private boolean isQuorumAware(Operation op) { return op.getService() instanceof QuorumAwareService; }
public static void before(List<Operation> operationList, Operation wrapper) throws Exception { for (Operation operation : operationList) { operation.setService(wrapper.getService()); operation.setServiceName(wrapper.getServiceName()); operation.setCallerUuid(wrapper.getCallerUuid()); operation.setNodeEngine(wrapper.getNodeEngine()); operation.setPartitionId(wrapper.getPartitionId()); operation.beforeRun(); } }
private void checkServiceNamespaces(BackupAwareOperation backupAwareOp, Operation backupOp) { Operation op = (Operation) backupAwareOp; Object service; try { service = op.getService(); } catch (Exception ignored) { // operation doesn't know its service name return; } if (service instanceof FragmentedMigrationAwareService) { assert backupAwareOp instanceof ServiceNamespaceAware : service + " is instance of FragmentedMigrationAwareService, " + backupAwareOp + " should implement ServiceNamespaceAware!"; assert backupOp instanceof ServiceNamespaceAware : service + " is instance of FragmentedMigrationAwareService, " + backupOp + " should implement ServiceNamespaceAware!"; } else { assert !(backupAwareOp instanceof ServiceNamespaceAware) : service + " is NOT instance of FragmentedMigrationAwareService, " + backupAwareOp + " should NOT implement ServiceNamespaceAware!"; assert !(backupOp instanceof ServiceNamespaceAware) : service + " is NOT instance of FragmentedMigrationAwareService, " + backupOp + " should NOT implement ServiceNamespaceAware!"; } }
private void checkServiceNamespaces(BackupAwareOperation backupAwareOp, Operation backupOp) { Operation op = (Operation) backupAwareOp; Object service; try { service = op.getService(); } catch (Exception ignored) { // operation doesn't know its service name return; } if (service instanceof FragmentedMigrationAwareService) { assert backupAwareOp instanceof ServiceNamespaceAware : service + " is instance of FragmentedMigrationAwareService, " + backupAwareOp + " should implement ServiceNamespaceAware!"; assert backupOp instanceof ServiceNamespaceAware : service + " is instance of FragmentedMigrationAwareService, " + backupOp + " should implement ServiceNamespaceAware!"; } else { assert !(backupAwareOp instanceof ServiceNamespaceAware) : service + " is NOT instance of FragmentedMigrationAwareService, " + backupAwareOp + " should NOT implement ServiceNamespaceAware!"; assert !(backupOp instanceof ServiceNamespaceAware) : service + " is NOT instance of FragmentedMigrationAwareService, " + backupOp + " should NOT implement ServiceNamespaceAware!"; } }
/** * Run the {@code size()} operation on the named * queue stored in the service. */ @Override public void run() { log.trace("run() for '{}'", this.name); MyPriorityQueueService myPriorityQueueService = super.getService(); this.response = myPriorityQueueService.getQueue(this.name).size(); }
/** * Run the {@code poll()} operation on the named * queue stored in the service. */ @SuppressWarnings("rawtypes") @Override public void run() { log.trace("run() for '{}'", this.name); MyPriorityQueueService myPriorityQueueService = super.getService(); PriorityQueue queue = myPriorityQueueService.getQueue(this.name); this.response = queue.poll(); }
/** * Run the {@code poll()} operation on the named * queue stored in the service. */ @SuppressWarnings({"unchecked", "rawtypes"}) @Override public void run() { log.trace("run() for '{}', payload '{}'", this.name, this.payload); MyPriorityQueueService myPriorityQueueService = super.getService(); PriorityQueue queue = myPriorityQueueService.getQueue(this.name); this.response = queue.offer(this.payload); }
private String getQuorumName(Operation op) { QuorumAwareService service; if (op instanceof ServiceNamespaceAware) { ServiceNamespace serviceNamespace = ((ServiceNamespaceAware) op).getServiceNamespace(); service = nodeEngine.getService(serviceNamespace.getServiceName()); } else { service = op.getService(); } String name = ((NamedOperation) op).getName(); return service.getQuorumName(name); }
private String getQuorumName(Operation op) { QuorumAwareService service; if (op instanceof ServiceNamespaceAware) { ServiceNamespace serviceNamespace = ((ServiceNamespaceAware) op).getServiceNamespace(); service = nodeEngine.getService(serviceNamespace.getServiceName()); } else { service = op.getService(); } String name = ((NamedOperation) op).getName(); return service.getQuorumName(name); }