From: <pj...@us...> - 2010-04-09 02:54:23
|
Revision: 7005 http://jython.svn.sourceforge.net/jython/?rev=7005&view=rev Author: pjenvey Date: 2010-04-09 02:54:17 +0000 (Fri, 09 Apr 2010) Log Message: ----------- make this SynchronizedCallable descriptor public so it can be introspected by future descriptor machinery Modified Paths: -------------- trunk/jython/src/org/python/modules/synchronize.java Modified: trunk/jython/src/org/python/modules/synchronize.java =================================================================== --- trunk/jython/src/org/python/modules/synchronize.java 2010-04-09 01:37:39 UTC (rev 7004) +++ trunk/jython/src/org/python/modules/synchronize.java 2010-04-09 02:54:17 UTC (rev 7005) @@ -2,61 +2,6 @@ package org.python.modules; import org.python.core.*; -class SynchronizedCallable extends PyObject -{ - PyObject callable; - - public SynchronizedCallable(PyObject callable) { - this.callable = callable; - } - - public PyObject _doget(PyObject container) { - // TBD: third arg == null? Hmm... - return new PyMethod(this, container, null); - } - - public PyObject __call__() { - throw Py.TypeError("synchronized callable called with 0 args"); - } - - public PyObject __call__(PyObject arg) { - synchronized(synchronize._getSync(arg)) { - return callable.__call__(arg); - } - } - - public PyObject __call__(PyObject arg1, PyObject arg2) { - synchronized(synchronize._getSync(arg1)) { - return callable.__call__(arg1, arg2); - } - } - - public PyObject __call__(PyObject arg1, PyObject arg2, PyObject arg3) { - synchronized(synchronize._getSync(arg1)) { - return callable.__call__(arg1, arg2, arg3); - } - } - - public PyObject __call__(PyObject[] args, String[] keywords) { - if (args.length == 0) { - throw Py.TypeError("synchronized callable called with 0 args"); - } - synchronized(synchronize._getSync(args[0])) { - return callable.__call__(args, keywords); - } - } - - public PyObject __call__(PyObject arg1, PyObject[] args, - String[] keywords) - { - synchronized(synchronize._getSync(arg1)) { - return callable.__call__(arg1, args, keywords); - } - } - - -} - public class synchronize { public static Object _getSync(PyObject obj) { @@ -84,4 +29,59 @@ public static PyObject make_synchronized(PyObject callable) { return new SynchronizedCallable(callable); } + + public static class SynchronizedCallable extends PyObject + { + PyObject callable; + + public SynchronizedCallable(PyObject callable) { + this.callable = callable; + } + + public PyObject _doget(PyObject container) { + // TBD: third arg == null? Hmm... + return new PyMethod(this, container, null); + } + + public PyObject __call__() { + throw Py.TypeError("synchronized callable called with 0 args"); + } + + public PyObject __call__(PyObject arg) { + synchronized(synchronize._getSync(arg)) { + return callable.__call__(arg); + } + } + + public PyObject __call__(PyObject arg1, PyObject arg2) { + synchronized(synchronize._getSync(arg1)) { + return callable.__call__(arg1, arg2); + } + } + + public PyObject __call__(PyObject arg1, PyObject arg2, PyObject arg3) { + synchronized(synchronize._getSync(arg1)) { + return callable.__call__(arg1, arg2, arg3); + } + } + + public PyObject __call__(PyObject[] args, String[] keywords) { + if (args.length == 0) { + throw Py.TypeError("synchronized callable called with 0 args"); + } + synchronized(synchronize._getSync(args[0])) { + return callable.__call__(args, keywords); + } + } + + public PyObject __call__(PyObject arg1, PyObject[] args, + String[] keywords) + { + synchronized(synchronize._getSync(arg1)) { + return callable.__call__(arg1, args, keywords); + } + } + + + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |