Beispiel #1
0
 def __init__(self, id, acc):
     self.id = id
     self.acc = acc
     self.methods = []
     ThreadSafeFinalizer.add_finalizer(
         id,
         ref(self, lambda wr, i=self.id, a=self.acc: deleted(a, i)))
 def __init__(self, id, acc):
     self.id = id
     self.acc = acc
     self.methods = []
     ThreadSafeFinalizer.add_finalizer(
         id,
         ref(self, lambda wr, i=self.id, a=self.acc: deleted(a, i)))
Beispiel #3
0
def _garbage_collect_object(gateway_client, target_id):
    #    print(target_id + ' deleted')
    ThreadSafeFinalizer.remove_finalizer(
        smart_decode(gateway_client.address) +
        smart_decode(gateway_client.port) + target_id)
    if target_id != ENTRY_POINT_OBJECT_ID and gateway_client.is_connected:
        try:
            gateway_client.send_command(MEMORY_COMMAND_NAME +
                                        MEMORY_DEL_SUBCOMMAND_NAME +
                                        target_id + '\ne\n')
        except Exception:
            pass
Beispiel #4
0
def _garbage_collect_object(gateway_client, target_id):
#    print(target_id + ' deleted')
    ThreadSafeFinalizer.remove_finalizer(smart_decode(gateway_client.address) +
            smart_decode(gateway_client.port) + target_id)
    if target_id != ENTRY_POINT_OBJECT_ID and gateway_client.is_connected:
        try:
            gateway_client.send_command(MEMORY_COMMAND_NAME +
                                        MEMORY_DEL_SUBCOMMAND_NAME +
                                        target_id +
                                        '\ne\n'
                                        )
        except Exception:
            pass
Beispiel #5
0
    def __init__(self, target_id, gateway_client):
        """
        :param target_id: the identifier of the object on the JVM side. Given
         by the JVM.

        :param gateway_client: the gateway client used to communicate with
         the JVM.
        """
#        print(target_id + ' created.')
        self._target_id = target_id
        self._gateway_client = gateway_client
        self._auto_field = gateway_client.gateway_property.auto_field
        self._methods = {}

        key = smart_decode(self._gateway_client.address) +\
              smart_decode(self._gateway_client.port) +\
              self._target_id

        value = weakref.ref(self, lambda wr, cc=self._gateway_client,
                id=self._target_id: _garbage_collect_object(cc, id))

        ThreadSafeFinalizer.add_finalizer(key, value)
Beispiel #6
0
    def __init__(self, target_id, gateway_client):
        """
        :param target_id: the identifier of the object on the JVM side. Given
         by the JVM.

        :param gateway_client: the gateway client used to communicate with
         the JVM.
        """
#        print(target_id + ' created.')
        self._target_id = target_id
        self._gateway_client = gateway_client
        self._auto_field = gateway_client.gateway_property.auto_field
        self._methods = {}

        key = smart_decode(self._gateway_client.address) +\
              smart_decode(self._gateway_client.port) +\
              self._target_id

        value = weakref.ref(self, lambda wr, cc=self._gateway_client,
                id=self._target_id: _garbage_collect_object(cc, id))

        ThreadSafeFinalizer.add_finalizer(key, value)
Beispiel #7
0
 def setUp(self):
     ThreadSafeFinalizer.clear_finalizers(True)
     self.p = start_example_app_process()
Beispiel #8
0
 def setUp(self):
     ThreadSafeFinalizer.clear_finalizers(True)
     self.p = start_example_app_process()