本文整理了Java中org.jruby.Ruby.newErrnoECONNREFUSEDError
方法的一些代码示例,展示了Ruby.newErrnoECONNREFUSEDError
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.newErrnoECONNREFUSEDError
方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:newErrnoECONNREFUSEDError
暂无
代码示例来源:origin: org.jruby/jruby-complete
/**
* Overrides BasicSocket#recv
*/
@Override
public IRubyObject recv(ThreadContext context, IRubyObject length) {
final Ruby runtime = context.runtime;
try {
return doReceive(this, runtime, false, RubyNumeric.fix2int(length), null);
}
catch (PortUnreachableException e) {
throw runtime.newErrnoECONNREFUSEDError();
}
catch (IOException e) { // SocketException
throw runtime.newIOErrorFromException(e);
}
catch (RaiseException e) { throw e; }
catch (Exception e) {
throw sockerr(runtime, e.getLocalizedMessage(), e);
}
}
代码示例来源:origin: org.jruby/jruby-core
public IRubyObject initialize(ThreadContext context, ProtocolFamily family) {
Ruby runtime = context.runtime;
try {
this.family = family;
DatagramChannel channel = DatagramChannel.open(family);
initSocket(newChannelFD(runtime, channel));
} catch (ConnectException e) {
throw runtime.newErrnoECONNREFUSEDError();
} catch (UnknownHostException e) {
throw SocketUtils.sockerr(runtime, "initialize: name or service not known");
} catch (UnsupportedOperationException uoe) {
if (uoe.getMessage().contains("IPv6 not available")) {
throw runtime.newErrnoEAFNOSUPPORTError("socket(2) - udp");
}
throw sockerr(runtime, "UnsupportedOperationException: " + uoe.getLocalizedMessage(), uoe);
} catch (IOException e) {
throw sockerr(runtime, "initialize: name or service not known", e);
}
return this;
}
代码示例来源:origin: org.jruby/jruby-core
/**
* Overrides BasicSocket#recv
*/
@Override
public IRubyObject recv(ThreadContext context, IRubyObject length) {
final Ruby runtime = context.runtime;
try {
return doReceive(this, runtime, false, RubyNumeric.fix2int(length), null);
}
catch (PortUnreachableException e) {
throw runtime.newErrnoECONNREFUSEDError();
}
catch (IOException e) { // SocketException
throw runtime.newIOErrorFromException(e);
}
catch (RaiseException e) { throw e; }
catch (Exception e) {
throw sockerr(runtime, e.getLocalizedMessage(), e);
}
}
代码示例来源:origin: org.jruby/jruby-complete
public IRubyObject initialize(ThreadContext context, ProtocolFamily family) {
Ruby runtime = context.runtime;
try {
this.family = family;
DatagramChannel channel = DatagramChannel.open(family);
initSocket(newChannelFD(runtime, channel));
} catch (ConnectException e) {
throw runtime.newErrnoECONNREFUSEDError();
} catch (UnknownHostException e) {
throw SocketUtils.sockerr(runtime, "initialize: name or service not known");
} catch (UnsupportedOperationException uoe) {
if (uoe.getMessage().contains("IPv6 not available")) {
throw runtime.newErrnoEAFNOSUPPORTError("socket(2) - udp");
}
throw sockerr(runtime, "UnsupportedOperationException: " + uoe.getLocalizedMessage(), uoe);
} catch (IOException e) {
throw sockerr(runtime, "initialize: name or service not known", e);
}
return this;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@JRubyMethod(visibility = Visibility.PRIVATE)
public IRubyObject initialize(ThreadContext context) {
Ruby runtime = context.runtime;
try {
DatagramChannel channel = DatagramChannel.open();
initSocket(runtime, new ChannelDescriptor(channel, newModeFlags(runtime, ModeFlags.RDWR)));
} catch (ConnectException e) {
throw runtime.newErrnoECONNREFUSEDError();
} catch (UnknownHostException e) {
throw SocketUtils.sockerr(runtime, "initialize: name or service not known");
} catch (IOException e) {
throw SocketUtils.sockerr(runtime, "initialize: name or service not known");
}
return this;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@JRubyMethod(visibility = Visibility.PRIVATE)
public IRubyObject initialize(ThreadContext context) {
Ruby runtime = context.runtime;
try {
DatagramChannel channel = DatagramChannel.open();
initSocket(runtime, new ChannelDescriptor(channel, newModeFlags(runtime, ModeFlags.RDWR)));
} catch (ConnectException e) {
throw runtime.newErrnoECONNREFUSEDError();
} catch (UnknownHostException e) {
throw SocketUtils.sockerr(runtime, "initialize: name or service not known");
} catch (IOException e) {
throw SocketUtils.sockerr(runtime, "initialize: name or service not known");
}
return this;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
throw runtime.newErrnoECONNREFUSEDError();
throw runtime.newErrnoECONNREFUSEDError();
代码示例来源:origin: org.jruby/jruby-complete
throw runtime.newErrnoECONNREFUSEDError("connect(2) for " + host.inspect() + " port " + remotePort);
throw runtime.newErrnoECONNREFUSEDError();
代码示例来源:origin: org.jruby/jruby-core
public static IRubyObject recvfrom(RubyBasicSocket socket, ThreadContext context, IRubyObject length) {
final Ruby runtime = context.runtime;
try {
ReceiveTuple tuple = doReceiveTuple(socket, runtime, false, RubyNumeric.fix2int(length));
IRubyObject addressArray = socket.addrFor(context, tuple.sender, false);
return runtime.newArray(tuple.result, addressArray);
}
catch (UnknownHostException e) {
throw SocketUtils.sockerr(runtime, "recvfrom: name or service not known");
}
catch (PortUnreachableException e) {
throw runtime.newErrnoECONNREFUSEDError();
}
catch (IOException e) { // SocketException
throw runtime.newIOErrorFromException(e);
}
catch (RaiseException e) { throw e; }
catch (Exception e) {
throw sockerr(runtime, e.getLocalizedMessage(), e);
}
}
代码示例来源:origin: org.jruby/jruby-complete
public static IRubyObject recvfrom(RubyBasicSocket socket, ThreadContext context, IRubyObject length) {
final Ruby runtime = context.runtime;
try {
ReceiveTuple tuple = doReceiveTuple(socket, runtime, false, RubyNumeric.fix2int(length));
IRubyObject addressArray = socket.addrFor(context, tuple.sender, false);
return runtime.newArray(tuple.result, addressArray);
}
catch (UnknownHostException e) {
throw SocketUtils.sockerr(runtime, "recvfrom: name or service not known");
}
catch (PortUnreachableException e) {
throw runtime.newErrnoECONNREFUSEDError();
}
catch (IOException e) { // SocketException
throw runtime.newIOErrorFromException(e);
}
catch (RaiseException e) { throw e; }
catch (Exception e) {
throw sockerr(runtime, e.getLocalizedMessage(), e);
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
/**
* Overrides IPSocket#recvfrom
*/
@Override
public IRubyObject recvfrom(ThreadContext context, IRubyObject _length) {
Ruby runtime = context.runtime;
try {
int length = RubyNumeric.fix2int(_length);
ReceiveTuple tuple = doReceiveTuple(runtime, length);
IRubyObject addressArray = addrFor(context, tuple.sender, false);
return runtime.newArray(tuple.result, addressArray);
} catch (UnknownHostException e) {
throw SocketUtils.sockerr(runtime, "recvfrom: name or service not known");
} catch (PortUnreachableException e) {
throw runtime.newErrnoECONNREFUSEDError();
} catch (IOException e) {
throw SocketUtils.sockerr(runtime, "recvfrom: name or service not known");
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
/**
* Overrides IPSocket#recvfrom
*/
@Override
public IRubyObject recvfrom(ThreadContext context, IRubyObject _length) {
Ruby runtime = context.runtime;
try {
int length = RubyNumeric.fix2int(_length);
ReceiveTuple tuple = doReceiveTuple(runtime, length);
IRubyObject addressArray = addrFor(context, tuple.sender, false);
return runtime.newArray(tuple.result, addressArray);
} catch (UnknownHostException e) {
throw SocketUtils.sockerr(runtime, "recvfrom: name or service not known");
} catch (PortUnreachableException e) {
throw runtime.newErrnoECONNREFUSEDError();
} catch (IOException e) {
throw SocketUtils.sockerr(runtime, "recvfrom: name or service not known");
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@JRubyMethod
public IRubyObject recvfrom_nonblock(ThreadContext context, IRubyObject _length) {
Ruby runtime = context.runtime;
try {
int length = RubyNumeric.fix2int(_length);
ReceiveTuple tuple = doReceiveNonblockTuple(runtime, length);
IRubyObject addressArray = addrFor(context, tuple.sender, false);
return runtime.newArray(tuple.result, addressArray);
} catch (UnknownHostException e) {
throw SocketUtils.sockerr(runtime, "recvfrom: name or service not known");
} catch (PortUnreachableException e) {
throw runtime.newErrnoECONNREFUSEDError();
} catch (IOException e) {
throw SocketUtils.sockerr(runtime, "recvfrom: name or service not known");
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@JRubyMethod
public IRubyObject recvfrom_nonblock(ThreadContext context, IRubyObject _length) {
Ruby runtime = context.runtime;
try {
int length = RubyNumeric.fix2int(_length);
ReceiveTuple tuple = doReceiveNonblockTuple(runtime, length);
IRubyObject addressArray = addrFor(context, tuple.sender, false);
return runtime.newArray(tuple.result, addressArray);
} catch (UnknownHostException e) {
throw SocketUtils.sockerr(runtime, "recvfrom: name or service not known");
} catch (PortUnreachableException e) {
throw runtime.newErrnoECONNREFUSEDError();
} catch (IOException e) {
throw SocketUtils.sockerr(runtime, "recvfrom: name or service not known");
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
private void doConnectNonblock(ThreadContext context, Channel channel, SocketAddress addr) {
if (!(channel instanceof SelectableChannel)) {
throw getRuntime().newErrnoENOPROTOOPTError();
}
SelectableChannel selectable = (SelectableChannel)channel;
synchronized (selectable.blockingLock()) {
boolean oldBlocking = selectable.isBlocking();
try {
selectable.configureBlocking(false);
try {
doConnect(context, channel, addr);
} finally {
selectable.configureBlocking(oldBlocking);
}
} catch(ClosedChannelException e) {
throw context.runtime.newErrnoECONNREFUSEDError();
} catch(IOException e) {
throw SocketUtils.sockerr(context.runtime, "connect(2): name or service not known");
}
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
private void doConnectNonblock(ThreadContext context, Channel channel, SocketAddress addr) {
if (!(channel instanceof SelectableChannel)) {
throw getRuntime().newErrnoENOPROTOOPTError();
}
SelectableChannel selectable = (SelectableChannel)channel;
synchronized (selectable.blockingLock()) {
boolean oldBlocking = selectable.isBlocking();
try {
selectable.configureBlocking(false);
try {
doConnect(context, channel, addr);
} finally {
selectable.configureBlocking(oldBlocking);
}
} catch(ClosedChannelException e) {
throw context.runtime.newErrnoECONNREFUSEDError();
} catch(IOException e) {
throw SocketUtils.sockerr(context.runtime, "connect(2): name or service not known");
}
}
}
代码示例来源:origin: org.jruby/jruby-complete
private IRubyObject doConnectNonblock(ThreadContext context, SocketAddress addr, boolean ex) {
Channel channel = getChannel();
if ( ! (channel instanceof SelectableChannel) ) {
throw context.runtime.newErrnoENOPROTOOPTError();
}
SelectableChannel selectable = (SelectableChannel) channel;
synchronized (selectable.blockingLock()) {
boolean oldBlocking = selectable.isBlocking();
try {
selectable.configureBlocking(false);
try {
return doConnect(context, addr, ex);
} finally {
selectable.configureBlocking(oldBlocking);
}
}
catch (ClosedChannelException e) {
throw context.runtime.newErrnoECONNREFUSEDError();
}
catch (IOException e) {
throw sockerr(context.runtime, "connect(2): name or service not known", e);
}
}
}
代码示例来源:origin: org.jruby/jruby-core
private IRubyObject doConnectNonblock(ThreadContext context, SocketAddress addr, boolean ex) {
Channel channel = getChannel();
if ( ! (channel instanceof SelectableChannel) ) {
throw context.runtime.newErrnoENOPROTOOPTError();
}
SelectableChannel selectable = (SelectableChannel) channel;
synchronized (selectable.blockingLock()) {
boolean oldBlocking = selectable.isBlocking();
try {
selectable.configureBlocking(false);
try {
return doConnect(context, addr, ex);
} finally {
selectable.configureBlocking(oldBlocking);
}
}
catch (ClosedChannelException e) {
throw context.runtime.newErrnoECONNREFUSEDError();
}
catch (IOException e) {
throw sockerr(context.runtime, "connect(2): name or service not known", e);
}
}
}
代码示例来源:origin: org.jruby/jruby-complete
throw runtime.newErrnoECONNREFUSEDError();
代码示例来源:origin: org.jruby/jruby-core
throw runtime.newErrnoECONNREFUSEDError();
内容来源于网络,如有侵权,请联系作者删除!