Skip to content

Commit

Permalink
2020-09-14 常识修改卡死的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
fanyong committed Sep 14, 2020
1 parent 1125e17 commit be2b07a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/ruiyun/jvppeteer/core/page/JSHandle.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public void dispose() {
* 当在websocket信息回调中处理时需要isBlock=false
* @param isBlock 是否是异步
*/
public void dispose(boolean isBlock) {
private void dispose(boolean isBlock) {
if (this.disposed)
return;
this.disposed = true;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/ruiyun/jvppeteer/util/Helper.java
Original file line number Diff line number Diff line change
Expand Up @@ -381,20 +381,20 @@ public static Object valueFromRemoteObject(RemoteObject remoteObject) {

public static void releaseObject(CDPSession client, RemoteObject remoteObject, boolean isBlock) {
if (isBlock) {
releaseObject(client, remoteObject);
doReleaseObject(client, remoteObject,isBlock);
} else {
Helper.commonExecutor().submit(() -> releaseObject(client, remoteObject));
Helper.commonExecutor().submit(() -> doReleaseObject(client, remoteObject,isBlock));
}

}

private static void releaseObject(CDPSession client, RemoteObject remoteObject) {
private static void doReleaseObject(CDPSession client, RemoteObject remoteObject,boolean isBlock) {
if (StringUtil.isEmpty(remoteObject.getObjectId()))
return;
Map<String, Object> params = new HashMap<>();
params.put("objectId", remoteObject.getObjectId());
try {
client.send("Runtime.releaseObject", params, true);
client.send("Runtime.releaseObject", params, isBlock);
} catch (Exception e) {
// Exceptions might happen in case of a page been navigated or closed.
//重新导航到某个网页 或者页面已经关闭
Expand Down

0 comments on commit be2b07a

Please sign in to comment.