Refine search
public File getFile(final String relativePath, final byte repoId, final File localDeploymentFolder) { try { return channelHandler.executeRequest(new GetFileRequest(relativePath, localDeploymentFolder), null).getResult().get(); } catch (Exception e) { throw ServerLogger.ROOT_LOGGER.failedToGetFileFromRemoteRepository(e); } } }
@Override public Integer getOperationId() { return support.getOperationId(); }
ActiveOperation.ResultHandler<Void> getResultHandler() { return operation.getResultHandler(); }
AsyncFuture<Long> future = null; try { if (interval < 1 || System.currentTimeMillis() - channelHandler.getLastMessageReceivedTime() > interval) { future = channelHandler.executeRequest(ManagementPingRequest.INSTANCE, null).getResult(); Long id = future.get(timeout, TimeUnit.MILLISECONDS); if (!cancelled && remoteConnectionID != null && !remoteConnectionID.equals(id)) { HostControllerLogger.DOMAIN_LOGGER.slaveHostControllerChanged(hostName); Channel channel = null; try { channel = channelHandler.getChannel(); } catch (IOException e) {
@Override public void connectionOpened(final Connection connection) throws IOException { final Channel channel = openChannel(connection, CHANNEL_SERVICE_TYPE, configuration.getOptionMap()); if(setChannel(channel)) { channel.receiveMessage(channelHandler.getReceiver()); channel.addCloseHandler(channelHandler); try { if (runningMode == RunningMode.ADMIN_ONLY) { // Fetch the domain configuration channelHandler.executeRequest(new FetchDomainConfigurationRequest(), null).getResult().get(); } else { // Start the registration process channelHandler.executeRequest(new RegisterHostControllerRequest(), null).getResult().get(); } } catch (Exception e) { if(e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new IOException(e); } // Registered registered(); } else { channel.closeAsync(); } }
/** * Send the started notification */ synchronized void started() { try { if(isConnected()) { channelHandler.executeRequest(new ServerStartedRequest(), null).getResult().await(); } } catch (Exception e) { ServerLogger.AS_ROOT_LOGGER.debugf(e, "failed to send started notification"); } }
/** * Execute a request. * * @param request the request * @param channel the channel * @param support the request support * @return the future result */ protected <T, A> AsyncFuture<T> executeRequest(final ManagementRequest<T, A> request, final Channel channel, final ActiveOperation<T, A> support) { assert support != null; updateChannelRef(support, channel); final Integer requestId = this.requestID.incrementAndGet(); final ActiveRequest<T, A> ar = new ActiveRequest<T, A>(support, request); requests.put(requestId, ar); final ManagementRequestHeader header = new ManagementRequestHeader(ManagementProtocol.VERSION, requestId, support.getOperationId(), request.getOperationType()); final ActiveOperation.ResultHandler<T> resultHandler = support.getResultHandler(); try { request.sendRequest(resultHandler, new ManagementRequestContextImpl<T, A>(support, channel, header, getExecutor())); } catch (Exception e) { resultHandler.failed(e); requests.remove(requestId); } return support.getResult(); }
protected AsyncFuture<OperationResponse> executeRequest(final ManagementRequest<OperationResponse, OperationExecutionContext> request, final OperationExecutionContext attachment) throws IOException { final ActiveOperation<OperationResponse, OperationExecutionContext> support = getChannelAssociation().executeRequest(request, attachment, attachment); return new DelegatingCancellableAsyncFuture(support.getResult(), support.getOperationId()); }
@Override public <T extends Operation> AsyncFuture<ModelNode> execute(TransactionalOperationListener<T> listener, T operation) throws IOException { final ExecuteRequestContext context = new ExecuteRequestContext(new OperationWrapper<T>(listener, operation)); final ActiveOperation<ModelNode, ExecuteRequestContext> op = channelAssociation.initializeOperation(context, context); final AsyncFuture<ModelNode> result = new AbstractDelegatingAsyncFuture<ModelNode>(op.getResult()) { @Override public void asyncCancel(boolean interruptionDesired) { try { // Execute channelAssociation.executeRequest(op, new CompleteTxRequest(ModelControllerProtocol.PARAM_ROLLBACK)); } catch (Exception e) { throw new RuntimeException(e); } } }; context.initialize(result); channelAssociation.executeRequest(op, new ExecuteRequest()); return result; }
Integer operationID = registrationContext.activeOperation.getOperationId(); final Transformers transformers = Transformers.Factory.create(target); try { SlaveChannelAttachments.attachSlaveInfo(handler.getChannel(), registrationContext.hostName, transformers); } catch (IOException e) { throw new OperationFailedException(e.getLocalizedMessage());
@Override public A getAttachment() { return support.getAttachment(); }
Runnable createAsyncTaskRunner(final AsyncTask<A> task) { final ManagementRequestContext<A> context = this; final AsyncTaskRunner runner = new AsyncTaskRunner() { @Override protected void doExecute() { try { task.execute(context); } catch (Exception e) { resultHandler.failed(e); requests.remove(requestId); } } }; support.addCancellable(runner); return runner; }
AsyncFuture<Long> future = null; try { if (interval < 1 || System.currentTimeMillis() - channelHandler.getLastMessageReceivedTime() > interval) { future = channelHandler.executeRequest(ManagementPingRequest.INSTANCE, null).getResult(); Long id = future.get(timeout, TimeUnit.MILLISECONDS); if (!cancelled && remoteConnectionID != null && !remoteConnectionID.equals(id)) { HostControllerLogger.DOMAIN_LOGGER.slaveHostControllerChanged(hostName); Channel channel = null; try { channel = channelHandler.getChannel(); } catch (IOException e) {
@Override public void connectionOpened(final Connection connection) throws IOException { final Channel channel = openChannel(connection, CHANNEL_SERVICE_TYPE, configuration.getOptionMap()); if(setChannel(channel)) { channel.receiveMessage(channelHandler.getReceiver()); channel.addCloseHandler(channelHandler); try { if (runningMode == RunningMode.ADMIN_ONLY) { // Fetch the domain configuration channelHandler.executeRequest(new FetchDomainConfigurationRequest(), null).getResult().get(); } else { // Start the registration process channelHandler.executeRequest(new RegisterHostControllerRequest(), null).getResult().get(); } } catch (Exception e) { if(e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new IOException(e); } // Registered registered(); } else { channel.closeAsync(); } }
/** * Send the started notification */ synchronized void started() { try { if(isConnected()) { channelHandler.executeRequest(new ServerStartedRequest(), null).getResult().await(); } } catch (Exception e) { ServerLogger.AS_ROOT_LOGGER.debugf(e, "failed to send started notification"); } }
/** * Execute a request. * * @param request the request * @param channel the channel * @param support the request support * @return the future result */ protected <T, A> AsyncFuture<T> executeRequest(final ManagementRequest<T, A> request, final Channel channel, final ActiveOperation<T, A> support) { assert support != null; updateChannelRef(support, channel); final Integer requestId = this.requestID.incrementAndGet(); final ActiveRequest<T, A> ar = new ActiveRequest<T, A>(support, request); requests.put(requestId, ar); final ManagementRequestHeader header = new ManagementRequestHeader(ManagementProtocol.VERSION, requestId, support.getOperationId(), request.getOperationType()); final ActiveOperation.ResultHandler<T> resultHandler = support.getResultHandler(); try { request.sendRequest(resultHandler, new ManagementRequestContextImpl<T, A>(support, channel, header, getExecutor())); } catch (Exception e) { resultHandler.failed(e); requests.remove(requestId); } return support.getResult(); }
protected AsyncFuture<ModelNode> executeRequest(final ManagementRequest<ModelNode, OperationExecutionContext> request, final OperationExecutionContext attachment) throws IOException { final ActiveOperation<ModelNode, OperationExecutionContext> support = getChannelAssociation().executeRequest(request, attachment, attachment); return new DelegatingCancellableAsyncFuture(support.getResult(), support.getOperationId()); }
@Override public <T extends Operation> AsyncFuture<OperationResponse> execute(TransactionalOperationListener<T> listener, T operation) throws IOException { AccessAuditContext accessAuditContext = WildFlySecurityManager.isChecking() ? doPrivileged((PrivilegedAction<AccessAuditContext>) AccessAuditContext::currentAccessAuditContext) : AccessAuditContext.currentAccessAuditContext(); final ExecuteRequestContext context = new ExecuteRequestContext(new OperationWrapper<>(listener, operation), accessAuditContext != null ? accessAuditContext.getSecurityIdentity() : null, accessAuditContext != null ? accessAuditContext.getRemoteAddress() : null, tempDir, InVmAccess.isInVmCall()); final ActiveOperation<OperationResponse, ExecuteRequestContext> op = channelAssociation.initializeOperation(context, context); final AtomicBoolean cancelSent = new AtomicBoolean(); final AsyncFuture<OperationResponse> result = new AbstractDelegatingAsyncFuture<OperationResponse>(op.getResult()) { @Override public synchronized void asyncCancel(boolean interruptionDesired) { if (!cancelSent.get()) { try { // Execute channelAssociation.executeRequest(op, new CompleteTxRequest(ModelControllerProtocol.PARAM_ROLLBACK, channelAssociation)); cancelSent.set(true); } catch (IOException e) { throw new RuntimeException(e); } } } }; context.initialize(result); channelAssociation.executeRequest(op, new ExecuteRequest()); return result; }
Integer operationID = registrationContext.activeOperation.getOperationId(); final Transformers transformers = Transformers.Factory.create(target); try { SlaveChannelAttachments.attachSlaveInfo(handler.getChannel(), registrationContext.hostName, transformers); } catch (IOException e) { throw new OperationFailedException(e.getLocalizedMessage());
@Override public A getAttachment() { return support.getAttachment(); }