本文整理了Java中org.jruby.Ruby.newErrnoEADDRINUSEError
方法的一些代码示例,展示了Ruby.newErrnoEADDRINUSEError
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.newErrnoEADDRINUSEError
方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:newErrnoEADDRINUSEError
暂无
代码示例来源:origin: org.jruby/jruby-core
public RaiseException newErrnoEADDRFromBindException(BindException be, String contextMessage) {
String msg = be.getMessage();
if (msg == null) {
msg = "bind";
} else {
msg = "bind - " + msg;
}
if (contextMessage != null) {
msg = msg + contextMessage;
}
// This is ugly, but what can we do, Java provides the same BindingException
// for both EADDRNOTAVAIL and EADDRINUSE, so we differentiate the errors
// based on BindException's message.
if(ADDR_NOT_AVAIL_PATTERN.matcher(msg).find()) {
return newErrnoEADDRNOTAVAILError(msg);
} else {
return newErrnoEADDRINUSEError(msg);
}
}
代码示例来源:origin: org.jruby/jruby-complete
public RaiseException newErrnoEADDRFromBindException(BindException be, String contextMessage) {
String msg = be.getMessage();
if (msg == null) {
msg = "bind";
} else {
msg = "bind - " + msg;
}
if (contextMessage != null) {
msg = msg + contextMessage;
}
// This is ugly, but what can we do, Java provides the same BindingException
// for both EADDRNOTAVAIL and EADDRINUSE, so we differentiate the errors
// based on BindException's message.
if(ADDR_NOT_AVAIL_PATTERN.matcher(msg).find()) {
return newErrnoEADDRNOTAVAILError(msg);
} else {
return newErrnoEADDRINUSEError(msg);
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
protected void handleSocketException(Ruby runtime, String caller, SocketException e) {
String msg = formatMessage(e, "bind");
// This is ugly, but what can we do, Java provides the same exception type
// for different situations, so we differentiate the errors
// based on the exception's message.
if (ALREADY_BOUND_PATTERN.matcher(msg).find()) {
throw runtime.newErrnoEINVALError(msg);
} else if (ADDR_NOT_AVAIL_PATTERN.matcher(msg).find()) {
throw runtime.newErrnoEADDRNOTAVAILError(msg);
} else if (PERM_DENIED_PATTERN.matcher(msg).find()) {
throw runtime.newErrnoEACCESError(msg);
} else {
throw runtime.newErrnoEADDRINUSEError(msg);
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public RaiseException newErrnoEADDRFromBindException(BindException be, String contextMessage) {
String msg = be.getMessage();
if (msg == null) {
msg = "bind";
} else {
msg = "bind - " + msg;
}
if (contextMessage != null) {
msg = msg + contextMessage;
}
// This is ugly, but what can we do, Java provides the same BindingException
// for both EADDRNOTAVAIL and EADDRINUSE, so we differentiate the errors
// based on BindException's message.
if(ADDR_NOT_AVAIL_PATTERN.matcher(msg).find()) {
return newErrnoEADDRNOTAVAILError(msg);
} else {
return newErrnoEADDRINUSEError(msg);
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
protected void handleSocketException(Ruby runtime, String caller, SocketException e) {
String msg = formatMessage(e, "bind");
// This is ugly, but what can we do, Java provides the same exception type
// for different situations, so we differentiate the errors
// based on the exception's message.
if (ALREADY_BOUND_PATTERN.matcher(msg).find()) {
throw runtime.newErrnoEINVALError(msg);
} else if (ADDR_NOT_AVAIL_PATTERN.matcher(msg).find()) {
throw runtime.newErrnoEADDRNOTAVAILError(msg);
} else if (PERM_DENIED_PATTERN.matcher(msg).find()) {
throw runtime.newErrnoEACCESError(msg);
} else {
throw runtime.newErrnoEADDRINUSEError(msg);
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public RaiseException newErrnoEADDRFromBindException(BindException be, String contextMessage) {
String msg = be.getMessage();
if (msg == null) {
msg = "bind";
} else {
msg = "bind - " + msg;
}
if (contextMessage != null) {
msg = msg + contextMessage;
}
// This is ugly, but what can we do, Java provides the same BindingException
// for both EADDRNOTAVAIL and EADDRINUSE, so we differentiate the errors
// based on BindException's message.
if(ADDR_NOT_AVAIL_PATTERN.matcher(msg).find()) {
return newErrnoEADDRNOTAVAILError(msg);
} else {
return newErrnoEADDRINUSEError(msg);
}
}
代码示例来源:origin: org.jruby/jruby-core
static void handleSocketException(final Ruby runtime, final SocketException ex,
final String caller, final SocketAddress addr) {
final String message = ex.getMessage();
if ( message != null ) {
switch ( message ) {
case "permission denied" :
case "Permission denied" :
if ( addr == null ) {
throw runtime.newErrnoEACCESError(caller + " - " + message);
}
throw runtime.newErrnoEACCESError("Address already in use - " + caller + " for " + formatAddress(addr));
case "Address already in use" :
throw runtime.newErrnoEADDRINUSEError(caller + " for " + formatAddress(addr));
case "Protocol family unavailable" :
throw runtime.newErrnoEADDRNOTAVAILError(caller + " for " + formatAddress(addr));
}
// This is ugly, but what can we do, Java provides the same exception type
// for different situations, so we differentiate the errors
// based on the exception's message.
if (ALREADY_BOUND_PATTERN.matcher(message).find()) {
throw runtime.newErrnoEINVALError(caller + " - " + message);
}
if (ADDR_NOT_AVAIL_PATTERN.matcher(message).find()) {
throw runtime.newErrnoEADDRNOTAVAILError(caller + " - " + message);
}
}
throw runtime.newErrnoEADDRINUSEError(caller + " - " + message);
}
代码示例来源:origin: org.jruby/jruby-complete
static void handleSocketException(final Ruby runtime, final SocketException ex,
final String caller, final SocketAddress addr) {
final String message = ex.getMessage();
if ( message != null ) {
switch ( message ) {
case "permission denied" :
case "Permission denied" :
if ( addr == null ) {
throw runtime.newErrnoEACCESError(caller + " - " + message);
}
throw runtime.newErrnoEACCESError("Address already in use - " + caller + " for " + formatAddress(addr));
case "Address already in use" :
throw runtime.newErrnoEADDRINUSEError(caller + " for " + formatAddress(addr));
case "Protocol family unavailable" :
throw runtime.newErrnoEADDRNOTAVAILError(caller + " for " + formatAddress(addr));
}
// This is ugly, but what can we do, Java provides the same exception type
// for different situations, so we differentiate the errors
// based on the exception's message.
if (ALREADY_BOUND_PATTERN.matcher(message).find()) {
throw runtime.newErrnoEINVALError(caller + " - " + message);
}
if (ADDR_NOT_AVAIL_PATTERN.matcher(message).find()) {
throw runtime.newErrnoEADDRNOTAVAILError(caller + " - " + message);
}
}
throw runtime.newErrnoEADDRINUSEError(caller + " - " + message);
}
内容来源于网络,如有侵权,请联系作者删除!