public abstract class Entry extends Object implements AutoCloseable
SphU#entry() will return an Entry. This class holds information of current invocation:Node, that is statistics of the resource in current context.Node, that is statistics for the specific origin. Usually the
origin could be the Service Consumer's app name, see
ContextUtil.enter(String name, String origin) ResourceWrapper, that is resource name.
A invocation tree will be created if we invoke SphU#entry() multi times in the same Context,
so parent or child entry may be held by this to form the tree. Since Context always holds
the current entry in the invocation tree, every exit() call should modify
Context.setCurEntry(Entry) as parent entry of this.
SphU,
Context,
ContextUtil| Modifier and Type | Field and Description |
|---|---|
protected ResourceWrapper |
resourceWrapper |
| Constructor and Description |
|---|
Entry(ResourceWrapper resourceWrapper) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Equivalent to
exit(). |
void |
exit()
Complete the current resource entry and restore the entry stack in context.
|
void |
exit(int count) |
abstract void |
exit(int count,
Object... args)
Exit this entry.
|
long |
getCreateTime() |
Node |
getCurNode() |
Throwable |
getError() |
abstract Node |
getLastNode()
|
Node |
getOriginNode()
|
ResourceWrapper |
getResourceWrapper() |
void |
setCurNode(Node node) |
void |
setError(Throwable error) |
void |
setOriginNode(Node originNode) |
protected abstract Entry |
trueExit(int count,
Object... args)
Exit this entry.
|
protected ResourceWrapper resourceWrapper
public Entry(ResourceWrapper resourceWrapper)
public ResourceWrapper getResourceWrapper()
public void exit()
throws ErrorEntryFreeException
ErrorEntryFreeException - if entry in current context does not match current entrypublic void exit(int count)
throws ErrorEntryFreeException
ErrorEntryFreeExceptionpublic void close()
exit(). Support try-with-resources since JDK 1.7.close in interface AutoCloseablepublic abstract void exit(int count,
Object... args)
throws ErrorEntryFreeException
count - tokens to release.args - extra parametersErrorEntryFreeException, - if Context.getCurEntry() is not this entry.ErrorEntryFreeExceptionprotected abstract Entry trueExit(int count, Object... args) throws ErrorEntryFreeException
count - tokens to release.args - extra parametersErrorEntryFreeException, - if Context.getCurEntry() is not this entry.ErrorEntryFreeExceptionpublic abstract Node getLastNode()
public long getCreateTime()
public Node getCurNode()
public void setCurNode(Node node)
public Throwable getError()
public void setError(Throwable error)
public Node getOriginNode()
Node of the this Entry, may be null if no origin specified by
ContextUtil.enter(String name, String origin).public void setOriginNode(Node originNode)
Copyright © 2019 Alibaba Group. All rights reserved.