@Override public void release(WorkerClient workerClient) { try { // Heartbeat to send the client metrics. workerClient.sessionHeartbeat(); } catch (IOException ioe) { LOG.warn("Failed sending client metrics before releasing the worker client", ioe); } workerClient.createNewSession(ClientContext.getRandomNonNegativeLong()); super.release(workerClient); }
@Override protected WorkerClient createNewResource() { long clientId = ClientContext.getRandomNonNegativeLong(); return new WorkerClient(mWorkerNetAddress, ClientContext.getExecutorService(), ClientContext.getConf(), clientId, true, ClientContext.getClientMetrics()); } }
/** * Obtains a non local worker client based on the hostname. Illegal argument exception is thrown * if the hostname is the local hostname. Runtime exception is thrown if the client cannot be * created with a connection to the hostname. * * @param hostname the worker hostname to connect to, empty string for any worker * @return a worker client with a connection to the specified hostname */ private synchronized WorkerClient acquireRemoteWorkerClient(String hostname) { Preconditions.checkArgument( !hostname.equals(NetworkAddressUtils.getLocalHostName(ClientContext.getConf())), "Acquire Remote Worker Client cannot not be called with local hostname"); NetAddress workerAddress = getWorkerAddress(hostname); // If we couldn't find a worker, crash. if (workerAddress == null) { // TODO(calvin): Better exception usage. throw new RuntimeException("No Tachyon worker available for host: " + hostname); } long clientId = ClientContext.getRandomNonNegativeLong(); return new WorkerClient(workerAddress, ClientContext.getExecutorService(), ClientContext.getConf(), clientId, false, new ClientMetrics()); }
mNonce = ClientContext.getRandomNonNegativeLong(); mBlockSize = options.getBlockSizeBytes(); mTachyonStorageType = options.getTachyonStorageType();