Auto logout on Garbage Collection
This commit is contained in:
parent
3fd31fcbd8
commit
fe134a4172
|
@ -78,11 +78,19 @@ public class UntisClient {
|
|||
public void logout() throws APIRequestException {
|
||||
try {
|
||||
client.invoke("logout", new Object[0], Object.class);
|
||||
auth = null;
|
||||
} catch (Throwable e) {
|
||||
throw new APIRequestException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
if (auth != null) {
|
||||
logout();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of subjects
|
||||
* @return an ArrayList of subjects
|
||||
|
|
Loading…
Reference in New Issue