How to restore java objects

6 visualizaciones (últimos 30 días)
Andreas Hofmann
Andreas Hofmann el 12 de Jun. de 2019
Comentada: Walter Roberson el 13 de Jun. de 2019
I have a javaobject (classname: aServerConnection) asigned to a matlab variable. Now this variable gets overwritten:
a = aServerConnection("abc",123);
a = 0;
Is there any way to restore this instance of aJavaClass without recreating a copy of it?
In this example i would like to call the function a.logout()
  1 comentario
Walter Roberson
Walter Roberson el 13 de Jun. de 2019
I do not find any method to retrieve a list of java objects that exist, such that one might go through the list looking for an object of the desired type.
I also would expect that MATLAB reference counts Java objects and destroys them when there is no more reference to the object. Otherwise there would have to be explicit release methods for every Java object so that the user could remove the Java object in a way different than the normal matlab variables.
https://www.mathworks.com/help/matlab/matlab_oop/handle-class-destructors.html

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Call Java from MATLAB en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by