use of org.jruby.runtime.ThreadContext in project jruby-openssl by jruby.
the class SSLSocket method copySessionSetupIfSet.
private void copySessionSetupIfSet() {
if (setSession != null) {
if (reusableSSLEngine()) {
engine.setEnableSessionCreation(false);
final ThreadContext context = getRuntime().getCurrentContext();
if (!setSession.equals(getSession(context.runtime))) {
getSession(context.runtime).set_timeout(context, setSession.timeout(context));
}
}
}
}
use of org.jruby.runtime.ThreadContext in project jruby-openssl by jruby.
the class SSLSocket method createSSLSocket.
public static void createSSLSocket(final Ruby runtime, final RubyModule SSL) {
// OpenSSL::SSL
final ThreadContext context = runtime.getCurrentContext();
RubyClass SSLSocket = SSL.defineClassUnder("SSLSocket", runtime.getObject(), ALLOCATOR);
// SSLSocket.addReadAttribute(context, "io");
// SSLSocket.defineAlias("to_io", "io");
// SSLSocket.addReadAttribute(context, "context");
SSLSocket.addReadWriteAttribute(context, "sync_close");
SSLSocket.addReadWriteAttribute(context, "hostname");
SSLSocket.defineAnnotatedMethods(SSLSocket.class);
SSLSocket.undefineMethod("dup");
}
use of org.jruby.runtime.ThreadContext in project nokogiri by sparklemotion.
the class NokogiriXPathFunction method evaluate.
public Object evaluate(List<?> args) throws XPathFunctionException {
if (args.size() != this.arity) {
throw new XPathFunctionException("arity does not match");
}
if (name.getNamespaceURI().equals(NokogiriNamespaceContext.NOKOGIRI_BUILTIN_URI)) {
if (name.getLocalPart().equals("css-class")) {
return builtinCssClass(args);
}
}
if (this.handler.isNil()) {
throw new XPathFunctionException("no custom function handler declared for '" + name + "'");
}
final Ruby runtime = this.handler.getRuntime();
ThreadContext context = runtime.getCurrentContext();
IRubyObject result = Helpers.invoke(context, this.handler, this.name.getLocalPart(), fromObjectToRubyArgs(runtime, args));
return fromRubyToObject(runtime, result);
}
use of org.jruby.runtime.ThreadContext in project nokogiri by sparklemotion.
the class NokogiriHandler method call.
private void call(String methodName, IRubyObject argument) {
ThreadContext context = runtime.getCurrentContext();
Helpers.invoke(context, document(context), methodName, argument);
}
use of org.jruby.runtime.ThreadContext in project nokogiri by sparklemotion.
the class NokogiriHandler method call.
private void call(String methodName) {
ThreadContext context = runtime.getCurrentContext();
Helpers.invoke(context, document(context), methodName);
}
Aggregations