public static IoFuture<Void> awaitWelcomeMessage(final Channel channel) { VersionedIoFuture<Void> future = new VersionedIoFuture<Void>(); channel.receiveMessage(new WelcomeMessageReceiver(future)); return future; }
private String begin() throws IOException { VersionedIoFuture<TypeExceptionHolder<String>> future = new VersionedIoFuture<TypeExceptionHolder<String>>(); final int correlationId = clientRequestManager.reserveNextCorrelationId(future); try { write(new MessageWriter() { @Override public void write(DataOutput output) throws IOException { output.writeByte(BEGIN); output.writeInt(correlationId); } }); log.tracef("[%d] begin - Request Sent", correlationId); IoFuture.Status result = future.await(timeoutSeconds, TimeUnit.SECONDS); switch (result) { case FAILED: throw future.getException(); case DONE: TypeExceptionHolder<String> response = future.get(); if (response.e == null) { return response.value; } throw toIoException(response.e); default: throw new IOException("Unable to invoke begin, status=" + result.toString()); } } finally { clientRequestManager.releaseCorrelationId(correlationId); } }
private void setKeyPair(final String key, final String value) throws IOException { VersionedIoFuture<TypeExceptionHolder<Void>> future = new VersionedIoFuture<TypeExceptionHolder<Void>>(); final int correlationId = clientRequestManager.reserveNextCorrelationId(future); try {
public String[] getDomains() throws IOException { VersionedIoFuture<TypeExceptionHolder<String[]>> future = new VersionedIoFuture<TypeExceptionHolder<String[]>>(); final int correlationId = clientRequestManager.reserveNextCorrelationId(future); try { write(new MessageWriter() { @Override public void write(DataOutput output) throws IOException { output.writeByte(GET_DOMAINS); output.writeInt(correlationId); } }); log.tracef("[%d] getDomains - Request Sent", correlationId); IoFuture.Status result = future.await(timeoutSeconds, TimeUnit.SECONDS); switch (result) { case DONE: TypeExceptionHolder<String[]> response = future.get(); if (response.e == null) { return response.value; } jmRuntimeException(response.e); throw toIoException(response.e); case FAILED: throw future.getException(); default: throw new IOException("Unable to obtain Domains, status=" + result.toString()); } } finally { clientRequestManager.releaseCorrelationId(correlationId); } }
public String getDefaultDomain() throws IOException { VersionedIoFuture<TypeExceptionHolder<String>> future = new VersionedIoFuture<TypeExceptionHolder<String>>(); final int correlationId = clientRequestManager.reserveNextCorrelationId(future); try { write(new MessageWriter() { @Override public void write(DataOutput output) throws IOException { output.writeByte(GET_DEFAULT_DOMAIN); output.writeInt(correlationId); } }); log.tracef("[%d] getDefaultDomain - Request Sent", correlationId); IoFuture.Status result = future.await(timeoutSeconds, TimeUnit.SECONDS); switch (result) { case DONE: TypeExceptionHolder<String> response = future.get(); if (response.e == null) { return response.value; } jmRuntimeException(response.e); throw toIoException(response.e); case FAILED: throw future.getException(); default: throw new IOException("Unable to obtain DefaultDomain, status=" + result.toString()); } } finally { clientRequestManager.releaseCorrelationId(correlationId); } }
public Integer getMBeanCount() throws IOException { VersionedIoFuture<TypeExceptionHolder<Integer>> future = new VersionedIoFuture<TypeExceptionHolder<Integer>>(); final int correlationId = clientRequestManager.reserveNextCorrelationId(future); try { write(new MessageWriter() { @Override public void write(DataOutput output) throws IOException { output.writeByte(GET_MBEAN_COUNT); output.writeInt(correlationId); } }); log.tracef("[%d] getMBeanCount - Request Sent", correlationId); IoFuture.Status result = future.await(timeoutSeconds, TimeUnit.SECONDS); switch (result) { case DONE: TypeExceptionHolder<Integer> response = future.get(); if (response.e == null) { return response.value; } jmRuntimeException(response.e); throw toIoException(response.e); case FAILED: throw future.getException(); default: throw new IOException("Unable to obtain MBeanCount, status=" + result.toString()); } } finally { clientRequestManager.releaseCorrelationId(correlationId); } }
public Set<ObjectName> queryNames(final ObjectName name, final QueryExp query) throws IOException { VersionedIoFuture<TypeExceptionHolder<Set<ObjectName>>> future = new VersionedIoFuture<TypeExceptionHolder<Set<ObjectName>>>(); final int correlationId = clientRequestManager.reserveNextCorrelationId(future); try {
public boolean isRegistered(final ObjectName name) throws IOException { VersionedIoFuture<TypeExceptionHolder<Boolean>> future = new VersionedIoFuture<TypeExceptionHolder<Boolean>>(); final int correlationId = clientRequestManager.reserveNextCorrelationId(future); try {
public Set<ObjectInstance> queryMBeans(final ObjectName name, final QueryExp query) throws IOException { VersionedIoFuture<TypeExceptionHolder<Set<ObjectInstance>>> future = new VersionedIoFuture<TypeExceptionHolder<Set<ObjectInstance>>>(); final int correlationId = clientRequestManager.reserveNextCorrelationId(future); try {
public ObjectInstance getObjectInstance(final ObjectName name) throws InstanceNotFoundException, IOException { VersionedIoFuture<TypeExceptionHolder<ObjectInstance>> future = new VersionedIoFuture<TypeExceptionHolder<ObjectInstance>>(); final int correlationId = clientRequestManager.reserveNextCorrelationId(future); try {
public boolean isInstanceOf(final ObjectName name, final String className) throws InstanceNotFoundException, IOException { VersionedIoFuture<TypeExceptionHolder<Boolean>> future = new VersionedIoFuture<TypeExceptionHolder<Boolean>>(); final int correlationId = clientRequestManager.reserveNextCorrelationId(future); try {
public void removeNotificationListener(final ObjectName name, final ObjectName listener) throws InstanceNotFoundException, ListenerNotFoundException, IOException { VersionedIoFuture<TypeExceptionHolder<Void>> future = new VersionedIoFuture<TypeExceptionHolder<Void>>(); final int correlationId = clientRequestManager.reserveNextCorrelationId(future); try {
public void addNotificationListener(final ObjectName name, final ObjectName listener, final NotificationFilter filter, final Object handback) throws InstanceNotFoundException, IOException { VersionedIoFuture<TypeExceptionHolder<Void>> future = new VersionedIoFuture<TypeExceptionHolder<Void>>(); final int correlationId = clientRequestManager.reserveNextCorrelationId(future); try {
public void unregisterMBean(final ObjectName name) throws InstanceNotFoundException, MBeanRegistrationException, IOException { VersionedIoFuture<TypeExceptionHolder<Void>> future = new VersionedIoFuture<TypeExceptionHolder<Void>>(); final int correlationId = clientRequestManager.reserveNextCorrelationId(future); try {
private void removeNotificationListener(final int[] listenerIds) throws InstanceNotFoundException, ListenerNotFoundException, IOException { VersionedIoFuture<TypeExceptionHolder<Void>> future = new VersionedIoFuture<TypeExceptionHolder<Void>>(); final int correlationId = clientRequestManager.reserveNextCorrelationId(future); try {
public AttributeList getAttributes(final ObjectName name, final String[] attributes) throws InstanceNotFoundException, ReflectionException, IOException { VersionedIoFuture<TypeExceptionHolder<AttributeList>> future = new VersionedIoFuture<TypeExceptionHolder<AttributeList>>(); final int correlationId = clientRequestManager.reserveNextCorrelationId(future); try {
public AttributeList setAttributes(final ObjectName name, final AttributeList attributes) throws InstanceNotFoundException, ReflectionException, IOException { VersionedIoFuture<TypeExceptionHolder<AttributeList>> future = new VersionedIoFuture<TypeExceptionHolder<AttributeList>>(); final int correlationId = clientRequestManager.reserveNextCorrelationId(future); try {
public MBeanInfo getMBeanInfo(final ObjectName name) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException { VersionedIoFuture<TypeExceptionHolder<MBeanInfo>> future = new VersionedIoFuture<TypeExceptionHolder<MBeanInfo>>(); final int correlationId = clientRequestManager.reserveNextCorrelationId(future); try {
public Object getAttribute(final ObjectName name, final String attribute) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException, IOException { VersionedIoFuture<TypeExceptionHolder<Object>> future = new VersionedIoFuture<TypeExceptionHolder<Object>>(); final int correlationId = clientRequestManager.reserveNextCorrelationId(future); try {
public void setAttribute(final ObjectName name, final Attribute attribute) throws InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException, IOException { VersionedIoFuture<TypeExceptionHolder<Void>> future = new VersionedIoFuture<TypeExceptionHolder<Void>>(); final int correlationId = clientRequestManager.reserveNextCorrelationId(future); try {