本文整理汇总了Java中org.apache.mina.core.RuntimeIoException类的典型用法代码示例。如果您正苦于以下问题:Java RuntimeIoException类的具体用法?Java RuntimeIoException怎么用?Java RuntimeIoException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RuntimeIoException类属于org.apache.mina.core包,在下文中一共展示了RuntimeIoException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMessage
import org.apache.mina.core.RuntimeIoException; //导入依赖的package包/类
public Object getMessage() {
if (isDone()) {
Object v = getValue();
if (v == CLOSED) {
return null;
}
if (v instanceof ExceptionHolder) {
v = ((ExceptionHolder) v).exception;
if (v instanceof RuntimeException) {
throw (RuntimeException) v;
}
if (v instanceof Error) {
throw (Error) v;
}
if (v instanceof IOException || v instanceof Exception) {
throw new RuntimeIoException((Exception) v);
}
}
return v;
}
return null;
}
示例2: connect
import org.apache.mina.core.RuntimeIoException; //导入依赖的package包/类
/**
* Attempt to connect to the info server.
*/
public void connect()
{
try
{
ConnectFuture future = connector.connect(new InetSocketAddress(IP, PORT));
future.awaitUninterruptibly(AWAIT_TIME);
IoSession session = future.getSession();
session.getFilterChain().addFirst("protocol", new ProtocolCodecFilter(factory));
state = State.READY;
this.onConnect(session);
}
catch(RuntimeIoException e)
{
this.onFailure(e);
}
}
示例3: main
import org.apache.mina.core.RuntimeIoException; //导入依赖的package包/类
public static void main(String[] args) {
NioSocketConnector connector = new NioSocketConnector(); //TCP Connector
connector.getFilterChain().addLast("logging", new LoggingFilter());
connector.getFilterChain().addLast("codec",new ProtocolCodecFilter(new ObjectSerializationCodecFactory()));
connector.getFilterChain().addLast("mdc", new MdcInjectionFilter());
connector.setHandler(new HelloClientHandler());
IoSession session;
for (;;) {
try {
ConnectFuture future = connector.connect(new InetSocketAddress(HOSTNAME, PORT));
future.awaitUninterruptibly();
session = future.getSession();
break;
} catch (RuntimeIoException e) {
System.err.println("Failed to connect.");
e.printStackTrace();
}
}
session.getCloseFuture().awaitUninterruptibly();
connector.dispose();
}
示例4: NioProcessor
import org.apache.mina.core.RuntimeIoException; //导入依赖的package包/类
/**
*
* Creates a new instance of NioProcessor.
*
* @param executor
*/
public NioProcessor(Executor executor) {
super(executor);
try {
// Open a new selector
selector = Selector.open();
} catch (IOException e) {
throw new RuntimeIoException("Failed to open a selector.", e);
}
}
示例5: isBroadcast
import org.apache.mina.core.RuntimeIoException; //导入依赖的package包/类
/**
* Tells if SO_BROADCAST is enabled.
*
* @return <code>true</code> if SO_BROADCAST is enabled
* @throws RuntimeIoException If the socket is closed or if we get an
* {@link SocketException}
*/
public boolean isBroadcast() {
try {
return channel.socket().getBroadcast();
} catch (SocketException e) {
throw new RuntimeIoException(e);
}
}
示例6: setBroadcast
import org.apache.mina.core.RuntimeIoException; //导入依赖的package包/类
public void setBroadcast(boolean broadcast) {
try {
channel.socket().setBroadcast(broadcast);
} catch (SocketException e) {
throw new RuntimeIoException(e);
}
}
示例7: getSendBufferSize
import org.apache.mina.core.RuntimeIoException; //导入依赖的package包/类
/**
*
* @throws RuntimeIoException If the socket is closed or if we get an
* {@link SocketException}
*/
public int getSendBufferSize() {
try {
return channel.socket().getSendBufferSize();
} catch (SocketException e) {
throw new RuntimeIoException(e);
}
}
示例8: setSendBufferSize
import org.apache.mina.core.RuntimeIoException; //导入依赖的package包/类
/**
*
* @throws RuntimeIoException If the socket is closed or if we get an
* {@link SocketException}
*/
public void setSendBufferSize(int sendBufferSize) {
try {
channel.socket().setSendBufferSize(sendBufferSize);
} catch (SocketException e) {
throw new RuntimeIoException(e);
}
}
示例9: isReuseAddress
import org.apache.mina.core.RuntimeIoException; //导入依赖的package包/类
/**
* Tells if SO_REUSEADDR is enabled.
*
* @return <code>true</code> if SO_REUSEADDR is enabled
* @throws RuntimeIoException If the socket is closed or if we get an
* {@link SocketException}
*/
public boolean isReuseAddress() {
try {
return channel.socket().getReuseAddress();
} catch (SocketException e) {
throw new RuntimeIoException(e);
}
}
示例10: setReuseAddress
import org.apache.mina.core.RuntimeIoException; //导入依赖的package包/类
/**
*
* @throws RuntimeIoException If the socket is closed or if we get an
* {@link SocketException}
*/
public void setReuseAddress(boolean reuseAddress) {
try {
channel.socket().setReuseAddress(reuseAddress);
} catch (SocketException e) {
throw new RuntimeIoException(e);
}
}
示例11: setTrafficClass
import org.apache.mina.core.RuntimeIoException; //导入依赖的package包/类
/**
* {@inheritDoc}
* @throws RuntimeIoException If the socket is closed or if we get an
* {@link SocketException}
*/
public void setTrafficClass(int trafficClass) {
try {
channel.socket().setTrafficClass(trafficClass);
} catch (SocketException e) {
throw new RuntimeIoException(e);
}
}
示例12: isKeepAlive
import org.apache.mina.core.RuntimeIoException; //导入依赖的package包/类
public boolean isKeepAlive() {
try {
return getSocket().getKeepAlive();
} catch (SocketException e) {
throw new RuntimeIoException(e);
}
}
示例13: setKeepAlive
import org.apache.mina.core.RuntimeIoException; //导入依赖的package包/类
public void setKeepAlive(boolean on) {
try {
getSocket().setKeepAlive(on);
} catch (SocketException e) {
throw new RuntimeIoException(e);
}
}
示例14: isOobInline
import org.apache.mina.core.RuntimeIoException; //导入依赖的package包/类
public boolean isOobInline() {
try {
return getSocket().getOOBInline();
} catch (SocketException e) {
throw new RuntimeIoException(e);
}
}
示例15: setOobInline
import org.apache.mina.core.RuntimeIoException; //导入依赖的package包/类
public void setOobInline(boolean on) {
try {
getSocket().setOOBInline(on);
} catch (SocketException e) {
throw new RuntimeIoException(e);
}
}