Esempio n. 1
0
    def out_tuple(self, req, msgid, message, data):
        # output a tuple into a tuplespace
        ts, tup = str(data[0]), data[1]

        assert utils.isTupleSpaceId(ts), "%s is not a tuplespace id" % (ts, )
        assert local_ts.has_key(ts)

        local_ts[ts]._out(tup)
        stats.inc_stat("message_out_total")

        req.send(msgid, (done, ))
Esempio n. 2
0
    def out_tuple(self, req, msgid, message, data):
        # output a tuple into a tuplespace
        ts, tup = str(data[0]), data[1]

        assert utils.isTupleSpaceId(ts), "%s is not a tuplespace id" % (ts, )
        assert local_ts.has_key(ts)

        local_ts[ts]._out(tup)
        stats.inc_stat("message_out_total")

        req.send(msgid, (done, ))
Esempio n. 3
0
    def in_tuple(self, req, msgid, message, data):
        ts, template, tid = str(data[0]), data[1], str(data[2])
        unblockable = message == inp_tuple

        blocked_threads[tid] = (req, ts)

        assert utils.isTupleSpaceId(ts), "%s is not a tuplespace id" % (ts, )
        assert local_ts.has_key(ts)

        r = local_ts[ts]._in(tid, template, unblockable)
        stats.inc_stat("message_in_total")

        if r is not None:
            del blocked_threads[tid]
            utils.changeOwner(r, ts, utils.getProcessIdFromThreadId(tid))
            req.send(msgid, ("RESULT_TUPLE", r))
        else:
            pass # this thread is now blocked
Esempio n. 4
0
    def in_tuple(self, req, msgid, message, data):
        ts, template, tid = str(data[0]), data[1], str(data[2])
        unblockable = message == inp_tuple

        blocked_threads[tid] = (req, ts)

        assert utils.isTupleSpaceId(ts), "%s is not a tuplespace id" % (ts, )
        assert local_ts.has_key(ts)

        r = local_ts[ts]._in(tid, template, unblockable)
        stats.inc_stat("message_in_total")

        if r is not None:
            del blocked_threads[tid]
            utils.changeOwner(r, ts, utils.getProcessIdFromThreadId(tid))
            req.send(msgid, ("RESULT_TUPLE", r))
        else:
            pass  # this thread is now blocked
Esempio n. 5
0
    def read_tuple(self, req, msgid, message, data):
        ts, template, tid = str(data[0]), data[1], str(data[2])
        unblockable = message == inp_tuple

        blocked_threads[tid] = (req, ts)

        assert utils.isTupleSpaceId(ts), "%s is not a tuplespace id" % (ts, )
        assert local_ts.has_key(ts)

        r = local_ts[ts]._rd(tid, template, unblockable)
        stats.inc_stat("message_rd_total")

        if r is not None:
            del blocked_threads[tid]

            # we found a tuple so update the references and return it
            utils.addReference(r, utils.getProcessIdFromThreadId(tid))

            req.send(msgid, ("RESULT_TUPLE", r))
        else:
            pass # this thread is now blocked
Esempio n. 6
0
    def read_tuple(self, req, msgid, message, data):
        ts, template, tid = str(data[0]), data[1], str(data[2])
        unblockable = message == inp_tuple

        blocked_threads[tid] = (req, ts)

        assert utils.isTupleSpaceId(ts), "%s is not a tuplespace id" % (ts, )
        assert local_ts.has_key(ts)

        r = local_ts[ts]._rd(tid, template, unblockable)
        stats.inc_stat("message_rd_total")

        if r is not None:
            del blocked_threads[tid]

            # we found a tuple so update the references and return it
            utils.addReference(r, utils.getProcessIdFromThreadId(tid))

            req.send(msgid, ("RESULT_TUPLE", r))
        else:
            pass  # this thread is now blocked