Skip to content

Commit

Permalink
Restyle
Browse files Browse the repository at this point in the history
  • Loading branch information
joonhaengHeo committed Feb 6, 2025
1 parent e6e310f commit 346d89c
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,16 @@ public class ChipClusters {
this.endpointId = endpointId;
this.clusterId = clusterId;

this.cleanable = Cleaner.create().register(this, () -> {
if (chipClusterPtr != 0) {
deleteCluster(chipClusterPtr);
chipClusterPtr = 0;
}
});
this.cleanable =
Cleaner.create()
.register(
this,
() -> {
if (chipClusterPtr != 0) {
deleteCluster(chipClusterPtr);
chipClusterPtr = 0;
}
});
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,16 @@ public BaseChipCluster(long devicePtr, int endpointId, long clusterId) {
this.endpointId = endpointId;
this.clusterId = clusterId;

this.cleanable = Cleaner.create().register(this, () -> {
if (chipClusterPtr != 0) {
deleteCluster(chipClusterPtr);
chipClusterPtr = 0;
}
});
this.cleanable =
Cleaner.create()
.register(
this,
() -> {
if (chipClusterPtr != 0) {
deleteCluster(chipClusterPtr);
chipClusterPtr = 0;
}
});
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,16 @@ public BaseChipCluster(long devicePtr, int endpointId, long clusterId) {
this.endpointId = endpointId;
this.clusterId = clusterId;

this.cleanable = Cleaner.create().register(this, () -> {
if (chipClusterPtr != 0) {
deleteCluster(chipClusterPtr);
chipClusterPtr = 0;
}
});
this.cleanable =
Cleaner.create()
.register(
this,
() -> {
if (chipClusterPtr != 0) {
deleteCluster(chipClusterPtr);
chipClusterPtr = 0;
}
});
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ public BatchInvokeCallbackJni(BatchInvokeCallback wrappedBatchInvokeCallback) {
this.wrappedBatchInvokeCallback = wrappedBatchInvokeCallback;
this.callbackHandle = newCallback();

this.cleanable = Cleaner.create().register(this, () -> {
if (chipClusterPtr != 0) {
deleteCluster(chipClusterPtr);
chipClusterPtr = 0;
}
});
this.cleanable =
Cleaner.create()
.register(
this,
() -> {
if (chipClusterPtr != 0) {
deleteCluster(chipClusterPtr);
chipClusterPtr = 0;
}
});
}

long getCallbackHandle() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,16 @@ public ChipDeviceController(ControllerParams params) {
}
deviceControllerPtr = newDeviceController(params);

this.cleanable = Cleaner.create().register(this, () -> {
if (deviceControllerPtr != 0) {
deleteDeviceController(deviceControllerPtr);
deviceControllerPtr = 0;
}
});
this.cleanable =
Cleaner.create()
.register(
this,
() -> {
if (deviceControllerPtr != 0) {
deleteDeviceController(deviceControllerPtr);
deviceControllerPtr = 0;
}
});
}

public void setCompletionListener(CompletionListener listener) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ public ExtendableInvokeCallbackJni(ExtendableInvokeCallback wrappedExtendableInv
this.wrappedExtendableInvokeCallback = wrappedExtendableInvokeCallback;
this.callbackHandle = newCallback();

this.cleanable = Cleaner.create().register(this, () -> {
if (callbackHandle != 0) {
deleteCallback(callbackHandle);
callbackHandle = 0;
}
});
this.cleanable =
Cleaner.create()
.register(
this,
() -> {
if (callbackHandle != 0) {
deleteCallback(callbackHandle);
callbackHandle = 0;
}
});
}

long getCallbackHandle() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@ public GetConnectedDeviceCallbackJni(GetConnectedDeviceCallback wrappedCallback)
this.wrappedCallback = wrappedCallback;
this.callbackHandle = newCallback(wrappedCallback);

this.cleanable = Cleaner.create().register(this, () -> {
if (callbackHandle != 0) {
deleteCallback(callbackHandle);
callbackHandle = 0;
}
});
this.cleanable =
Cleaner.create()
.register(
this,
() -> {
if (callbackHandle != 0) {
deleteCallback(callbackHandle);
callbackHandle = 0;
}
});
}

long getCallbackHandle() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
*/
package chip.devicecontroller;

import java.lang.ref.Cleaner;
import chip.devicecontroller.model.InvokeElement;
import java.lang.ref.Cleaner;

/** JNI wrapper callback class for {@link InvokeCallback}. */
public final class InvokeCallbackJni {
Expand All @@ -31,12 +31,16 @@ public InvokeCallbackJni(InvokeCallback wrappedInvokeCallback) {
this.wrappedInvokeCallback = wrappedInvokeCallback;
this.callbackHandle = newCallback();

this.cleanable = Cleaner.create().register(this, () -> {
if (callbackHandle != 0) {
deleteCallback(callbackHandle);
callbackHandle = 0;
}
});
this.cleanable =
Cleaner.create()
.register(
this,
() -> {
if (callbackHandle != 0) {
deleteCallback(callbackHandle);
callbackHandle = 0;
}
});
}

long getCallbackHandle() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,16 @@ public ReportCallbackJni(
this.callbackHandle =
newCallback(subscriptionEstablishedCallback, resubscriptionAttemptCallback);

this.cleanable = Cleaner.create().register(this, () -> {
if (callbackHandle != 0) {
deleteCallback(callbackHandle);
callbackHandle = 0;
}
});
this.cleanable =
Cleaner.create()
.register(
this,
() -> {
if (callbackHandle != 0) {
deleteCallback(callbackHandle);
callbackHandle = 0;
}
});
}

long getCallbackHandle() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,16 @@ public WriteAttributesCallbackJni(WriteAttributesCallback wrappedWriteAttributes
this.wrappedWriteAttributesCallback = wrappedWriteAttributesCallback;
this.callbackHandle = newCallback();

this.cleanable = Cleaner.create().register(this, () -> {
if (callbackHandle != 0) {
deleteCallback(callbackHandle);
callbackHandle = 0;
}
});
this.cleanable =
Cleaner.create()
.register(
this,
() -> {
if (callbackHandle != 0) {
deleteCallback(callbackHandle);
callbackHandle = 0;
}
});
}

long getCallbackHandle() {
Expand Down

0 comments on commit 346d89c

Please sign in to comment.