/** * Initialize */ public void initialize() { if (distributedStatistics != null) { distributedStatistics.setOwnId(getLocalAddress()); distributedStatistics.setTransport(transport); } }
/** * {@inheritDoc} */ @Override public long startWork(Work work) throws WorkException { if (policy == null || selector == null || transport == null || work == null || !(work instanceof DistributableWork) || !startWorkDistributionEnabled) { return localStartWork(work); } else { doFirstChecks(work, WorkManager.INDEFINITE, null); checkTransport(); DistributableWork dw = (DistributableWork)work; if (policy.shouldDistribute(this, dw)) { Address dwmAddress = selector.selectDistributedWorkManager(getLocalAddress(), dw); if (dwmAddress != null && !getLocalAddress().equals(dwmAddress)) { return transport.startWork(dwmAddress, dw); } } return localStartWork(work); } }
Address dwmAddress = selector.selectDistributedWorkManager(getLocalAddress(), dw); if (dwmAddress != null && !getLocalAddress().equals(dwmAddress))
Address dwmAddress = selector.selectDistributedWorkManager(getLocalAddress(), dw); if (dwmAddress != null && !getLocalAddress().equals(dwmAddress))
/** * {@inheritDoc} */ public void localDoWork(Work work) throws WorkException { if (transport != null) { checkTransport(); if (getLongRunningThreadPool() != null && WorkManagerUtil.isLongRunning(work)) { transport.updateLongRunningFree(getLocalAddress(), getLongRunningThreadPool().getNumberOfFreeThreads() - 1); } else { transport.updateShortRunningFree(getLocalAddress(), getShortRunningThreadPool().getNumberOfFreeThreads() - 1); } WorkEventListener wel = new WorkEventListener(WorkManagerUtil.isLongRunning(work), getShortRunningThreadPool(), getLongRunningThreadPool(), getLocalAddress(), transport); super.doWork(work, WorkManager.INDEFINITE, null, wel); } else { super.doWork(work); } }
/** * {@inheritDoc} */ public long localStartWork(Work work) throws WorkException { if (transport != null) { checkTransport(); if (getLongRunningThreadPool() != null && WorkManagerUtil.isLongRunning(work)) { transport.updateLongRunningFree(getLocalAddress(), getLongRunningThreadPool().getNumberOfFreeThreads() - 1); } else { transport.updateShortRunningFree(getLocalAddress(), getShortRunningThreadPool().getNumberOfFreeThreads() - 1); } WorkEventListener wel = new WorkEventListener(WorkManagerUtil.isLongRunning(work), getShortRunningThreadPool(), getLongRunningThreadPool(), getLocalAddress(), transport); return super.startWork(work, WorkManager.INDEFINITE, null, wel); } else { return super.startWork(work); } }
/** * {@inheritDoc} */ public void localScheduleWork(Work work) throws WorkException { if (transport != null) { checkTransport(); if (getLongRunningThreadPool() != null && WorkManagerUtil.isLongRunning(work)) { transport.updateLongRunningFree(getLocalAddress(), getLongRunningThreadPool().getNumberOfFreeThreads() - 1); } else { transport.updateShortRunningFree(getLocalAddress(), getShortRunningThreadPool().getNumberOfFreeThreads() - 1); } WorkEventListener wel = new WorkEventListener(WorkManagerUtil.isLongRunning(work), getShortRunningThreadPool(), getLongRunningThreadPool(), getLocalAddress(), transport); super.scheduleWork(work, WorkManager.INDEFINITE, null, wel); } else { super.scheduleWork(work); } }