Search in sources :

Example 1 with SessionCleanupCallback

use of alluxio.worker.SessionCleanupCallback in project alluxio by Alluxio.

the class DefaultBlockWorker method start.

/**
   * Runs the block worker. The thread must be called after all services (e.g., web, dataserver)
   * started.
   *
   * @throws IOException if a non-Alluxio related exception occurs
   */
@Override
public void start() throws IOException {
    Preconditions.checkNotNull(mWorkerId, "mWorkerId");
    Preconditions.checkNotNull(mAddress, "mAddress");
    // Setup BlockMasterSync
    mBlockMasterSync = new BlockMasterSync(this, mWorkerId, mAddress, mBlockMasterClient);
    // Setup PinListSyncer
    mPinListSync = new PinListSync(this, mFileSystemMasterClient);
    // Setup session cleaner
    mSessionCleaner = new SessionCleaner(new SessionCleanupCallback() {

        /**
       * Cleans up after sessions, to prevent zombie sessions holding local resources.
       */
        @Override
        public void cleanupSessions() {
            for (long session : mSessions.getTimedOutSessions()) {
                mSessions.removeSession(session);
                mBlockStore.cleanupSession(session);
                mUnderFileSystemBlockStore.cleanupSession(session);
            }
        }
    });
    // Setup space reserver
    if (Configuration.getBoolean(PropertyKey.WORKER_TIERED_STORE_RESERVER_ENABLED)) {
        getExecutorService().submit(new HeartbeatThread(HeartbeatContext.WORKER_SPACE_RESERVER, new SpaceReserver(this), Configuration.getInt(PropertyKey.WORKER_TIERED_STORE_RESERVER_INTERVAL_MS)));
    }
    getExecutorService().submit(new HeartbeatThread(HeartbeatContext.WORKER_BLOCK_SYNC, mBlockMasterSync, Configuration.getInt(PropertyKey.WORKER_BLOCK_HEARTBEAT_INTERVAL_MS)));
    // Start the pinlist syncer to perform the periodical fetching
    getExecutorService().submit(new HeartbeatThread(HeartbeatContext.WORKER_PIN_LIST_SYNC, mPinListSync, Configuration.getInt(PropertyKey.WORKER_BLOCK_HEARTBEAT_INTERVAL_MS)));
    // Start the session cleanup checker to perform the periodical checking
    getExecutorService().submit(mSessionCleaner);
}
Also used : SessionCleanupCallback(alluxio.worker.SessionCleanupCallback) HeartbeatThread(alluxio.heartbeat.HeartbeatThread) SessionCleaner(alluxio.worker.SessionCleaner)

Aggregations

HeartbeatThread (alluxio.heartbeat.HeartbeatThread)1 SessionCleaner (alluxio.worker.SessionCleaner)1 SessionCleanupCallback (alluxio.worker.SessionCleanupCallback)1