Package org.jboss.remoting3.spi
Class SpiUtils
- java.lang.Object
-
- org.jboss.remoting3.spi.SpiUtils
-
public final class SpiUtils extends Object
Utility methods for Remoting service providers.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CloseHandler<Object>
asyncClosingCloseHandler(HandleableCloseable<?> c)
A close handler which closes another resource asynchronously.static CloseHandler<Object>
closingCloseHandler(Closeable c)
A close handler which closes another resource.static Runnable
getServiceOpenTask(Channel newChannel, OpenListener listener)
Get an executor task for opening a service.static void
glueStackTraces(Throwable exception, StackTraceElement[] userStackTrace, int trimCount, String msg)
Glue two stack traces together.static <T> void
safeHandleClose(CloseHandler<? super T> handler, T closed, IOException exception)
Safely handle a close notification.
-
-
-
Method Detail
-
safeHandleClose
public static <T> void safeHandleClose(CloseHandler<? super T> handler, T closed, IOException exception)
Safely handle a close notification.- Type Parameters:
T
- the type of the closed resource- Parameters:
handler
- the close handlerclosed
- the object that was closedexception
- the close exception, ornull
if the close succeeded
-
closingCloseHandler
public static CloseHandler<Object> closingCloseHandler(Closeable c)
A close handler which closes another resource.- Parameters:
c
- the resource to close- Returns:
- the close handler
-
asyncClosingCloseHandler
public static CloseHandler<Object> asyncClosingCloseHandler(HandleableCloseable<?> c)
A close handler which closes another resource asynchronously.- Parameters:
c
- the resource to close- Returns:
- the close handler
-
glueStackTraces
public static void glueStackTraces(Throwable exception, StackTraceElement[] userStackTrace, int trimCount, String msg)
Glue two stack traces together.- Parameters:
exception
- the exception which occurred in another threaduserStackTrace
- the stack trace of the current thread fromThread.getStackTrace()
trimCount
- the number of frames to trimmsg
- the message to use
-
getServiceOpenTask
public static Runnable getServiceOpenTask(Channel newChannel, OpenListener listener)
Get an executor task for opening a service.- Parameters:
newChannel
- the new service channellistener
- the service open listener- Returns:
- the runnable task
-
-