-
Notifications
You must be signed in to change notification settings - Fork 706
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
107 additions
and
26 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
jarslink-api/src/main/java/com/alipay/jarslink/api/impl/ActionProxy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.alipay.jarslink.api.impl; | ||
|
||
import com.alipay.jarslink.api.Action; | ||
|
||
import static com.google.common.base.Preconditions.checkNotNull; | ||
|
||
/** | ||
* action代理 | ||
* | ||
* @author joe | ||
* @version 2018.04.16 22:33 | ||
*/ | ||
public class ActionProxy<R, T> implements Action<R, T> { | ||
private Action<R, T> action; | ||
|
||
/** | ||
* 默认构造器 | ||
* | ||
* @param action 要代理的Action | ||
*/ | ||
public ActionProxy(Action<R, T> action) { | ||
this.action = action; | ||
} | ||
|
||
/** | ||
* 关闭action,便于回收 | ||
*/ | ||
public void destroy() { | ||
action = null; | ||
} | ||
|
||
@Override | ||
public T execute(R actionRequest) { | ||
checkNotNull(action, "current module was closed"); | ||
return action.execute(actionRequest); | ||
} | ||
|
||
@Override | ||
public String getActionName() { | ||
checkNotNull(action, "current module was closed"); | ||
return action.getActionName(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters