proj_name
stringclasses
131 values
relative_path
stringlengths
30
228
class_name
stringlengths
1
68
func_name
stringlengths
1
48
masked_class
stringlengths
78
9.82k
func_body
stringlengths
46
9.61k
len_input
int64
29
2.01k
len_output
int64
14
1.94k
total
int64
55
2.05k
relevant_context
stringlengths
0
38.4k
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/HeartbeatHandler.java
HeartbeatHandler
userEventTriggered
class HeartbeatHandler extends ChannelDuplexHandler { /** * * @see io.netty.channel.ChannelInboundHandlerAdapter#userEventTriggered(io.netty.channel.ChannelHandlerContext, java.lang.Object) */ @Override public void userEventTriggered(final ChannelHandlerContext ctx, Object evt) throws Excep...
if (evt instanceof IdleStateEvent) { ProtocolCode protocolCode = ctx.channel().attr(Connection.PROTOCOL).get(); Protocol protocol = ProtocolManager.getProtocol(protocolCode); protocol.getHeartbeatTrigger().heartbeatTriggered(ctx); } else { super.userEvent...
105
96
201
<no_super_class>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/RpcClientRemoting.java
RpcClientRemoting
preProcessInvokeContext
class RpcClientRemoting extends RpcRemoting { public RpcClientRemoting(CommandFactory commandFactory, RemotingAddressParser addressParser, ConnectionManager connectionManager) { super(commandFactory, addressParser, connectionManager); } /** * @see com.alipay.remot...
if (null != invokeContext) { invokeContext.putIfAbsent(InvokeContext.CLIENT_LOCAL_IP, RemotingUtil.parseLocalIP(connection.getChannel())); invokeContext.putIfAbsent(InvokeContext.CLIENT_LOCAL_PORT, RemotingUtil.parseLocalPort(connection.getChannel())); ...
1,186
199
1,385
<methods>public void <init>(com.alipay.remoting.CommandFactory) ,public void <init>(com.alipay.remoting.CommandFactory, com.alipay.remoting.RemotingAddressParser, com.alipay.remoting.ConnectionManager) ,public java.lang.Object invokeSync(java.lang.String, java.lang.Object, com.alipay.remoting.InvokeContext, int) throws...
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/RpcCommand.java
RpcCommand
setHeader
class RpcCommand implements RemotingCommand { /** For serialization */ private static final long serialVersionUID = -3570261012462596503L; /** * Code which stands for the command. */ private CommandCode cmdCode; /* command version */ private byte version ...
if (header != null) { if (header.length > Short.MAX_VALUE) { throw new RuntimeException("header length exceed maximum, len=" + header.length); } this.headerLength = (short) header.length; this.header = header; }
1,900
76
1,976
<no_super_class>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/RpcCommandFactory.java
RpcCommandFactory
createExceptionResponse
class RpcCommandFactory implements CommandFactory { @Override public RpcRequestCommand createRequestCommand(Object requestObject) { return new RpcRequestCommand(requestObject); } @Override public RpcResponseCommand createResponse(final Object responseObject, ...
RpcResponseCommand responseCommand = this.createExceptionResponse(id, status); responseCommand.setResponseObject(createServerException(t, null)); responseCommand.setResponseClass(RpcServerException.class.getName()); return responseCommand;
1,049
63
1,112
<no_super_class>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/RpcConnectionEventHandler.java
RpcConnectionEventHandler
channelInactive
class RpcConnectionEventHandler extends ConnectionEventHandler { public RpcConnectionEventHandler() { super(); } public RpcConnectionEventHandler(Configuration configuration) { super(configuration); } /** * @see com.alipay.remoting.ConnectionEventHandler#channelInactive(io.ne...
Connection conn = ctx.channel().attr(Connection.CONNECTION).get(); if (conn != null) { this.getConnectionManager().remove(conn); } super.channelInactive(ctx);
127
57
184
<methods>public void <init>() ,public void <init>(com.alipay.remoting.config.Configuration) ,public void channelActive(ChannelHandlerContext) throws java.lang.Exception,public void channelInactive(ChannelHandlerContext) throws java.lang.Exception,public void channelRegistered(ChannelHandlerContext) throws java.lang.Exc...
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/RpcHandler.java
RpcHandler
channelRead
class RpcHandler extends ChannelInboundHandlerAdapter { private boolean serverSide; private ConcurrentHashMap<String, UserProcessor<?>> userProcessors; public RpcHandler(ConcurrentHashMap<String, UserProcessor<?>> userProcessors) { serverSide = false; th...
ProtocolCode protocolCode = ctx.channel().attr(Connection.PROTOCOL).get(); Protocol protocol = ProtocolManager.getProtocol(protocolCode); protocol.getCommandHandler().handleCommand( new RemotingContext(ctx, new InvokeContext(), serverSide, userProcessors), msg); ctx.fireChan...
178
85
263
<no_super_class>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/RpcInvokeCallbackListener.java
CallbackTask
run
class CallbackTask implements Runnable { InvokeFuture future; String remoteAddress; /** * */ public CallbackTask(String remoteAddress, InvokeFuture future) { this.remoteAddress = remoteAddress; this.future = future; } /**...
InvokeCallback callback = future.getInvokeCallback(); // a lot of try-catches to protect thread pool ResponseCommand response = null; try { response = (ResponseCommand) future.waitResponse(0); } catch (InterruptedException e) { ...
125
951
1,076
<no_super_class>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/RpcResponseFuture.java
RpcResponseFuture
get
class RpcResponseFuture { /** rpc server address */ private String addr; /** rpc server port */ private InvokeFuture future; /** * Constructor */ public RpcResponseFuture(String addr, InvokeFuture future) { this.addr = addr; this.future = future; } /** ...
this.future.waitResponse(timeoutMillis); if (!isDone()) { throw new InvokeTimeoutException("Future get result timeout!"); } ResponseCommand responseCommand = (ResponseCommand) this.future.waitResponse(); responseCommand.setInvokeContext(this.future.getInvokeContext()...
282
96
378
<no_super_class>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/RpcResponseResolver.java
RpcResponseResolver
preProcess
class RpcResponseResolver { private static final Logger logger = BoltLoggerFactory.getLogger("RpcRemoting"); /** * Analyze the response command and generate the response object. * * @param responseCommand response command * @param addr response address * @return response object */...
RemotingException e = null; String msg = null; if (responseCommand == null) { msg = String.format("Rpc invocation timeout[responseCommand null]! the address is %s", addr); e = new InvokeTimeoutException(msg); } else { switch (responseC...
634
693
1,327
<no_super_class>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/RpcServerRemoting.java
RpcServerRemoting
invokeSync
class RpcServerRemoting extends RpcRemoting { /** * default constructor */ public RpcServerRemoting(CommandFactory commandFactory) { super(commandFactory); } /** * @param addressParser * @param connectionManager */ public RpcServerRemoting(CommandFactory commandFac...
Connection conn = this.connectionManager.get(url.getUniqueKey()); if (null == conn) { throw new RemotingException("Client address [" + url.getUniqueKey() + "] not connected yet!"); } this.connectionManager.check(conn); return t...
1,028
93
1,121
<methods>public void <init>(com.alipay.remoting.CommandFactory) ,public void <init>(com.alipay.remoting.CommandFactory, com.alipay.remoting.RemotingAddressParser, com.alipay.remoting.ConnectionManager) ,public java.lang.Object invokeSync(java.lang.String, java.lang.Object, com.alipay.remoting.InvokeContext, int) throws...
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/RpcTaskScanner.java
RpcTaskScanner
run
class RpcTaskScanner extends AbstractLifeCycle { private static final Logger logger = BoltLoggerFactory.getLogger("RpcRemoting"); private final List<Scannable> scanList; private ScheduledExecutorService scheduledService; public RpcTaskScanner() { this.scanList = new LinkedList<Scanna...
for (Scannable scanned : scanList) { try { scanned.scan(); } catch (Throwable t) { logger.error("Exception caught when scannings.", t); } }
343
59
402
<methods>public non-sealed void <init>() ,public boolean isStarted() ,public void shutdown() throws com.alipay.remoting.LifeCycleException,public void startup() throws com.alipay.remoting.LifeCycleException<variables>private final java.util.concurrent.atomic.AtomicBoolean isStarted
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/protocol/AsyncMultiInterestUserProcessor.java
AsyncMultiInterestUserProcessor
handleRequest
class AsyncMultiInterestUserProcessor<T> extends AbstractMultiInterestUserProcessor<T> { /** * unsupported here! * * @see com.alipay.remoting.rpc.protocol.UserProcessor#handleRequest(com.alipay.remoting.BizContext, java.lang.Object) */ ...
throw new UnsupportedOperationException( "SYNC handle request is unsupported in AsyncMultiInterestUserProcessor!");
265
31
296
<methods>public non-sealed void <init>() ,public java.lang.String interest() <variables>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/protocol/AsyncUserProcessor.java
AsyncUserProcessor
handleRequest
class AsyncUserProcessor<T> extends AbstractUserProcessor<T> { /** * unsupported here! * * @see com.alipay.remoting.rpc.protocol.UserProcessor#handleRequest(com.alipay.remoting.BizContext, java.lang.Object) */ @Override public Object handleRequest(BizContext bizCtx, T request) throws Exc...
throw new UnsupportedOperationException( "SYNC handle request is unsupported in AsyncUserProcessor!");
251
29
280
<methods>public non-sealed void <init>() ,public java.lang.ClassLoader getBizClassLoader() ,public java.util.concurrent.Executor getExecutor() ,public com.alipay.remoting.rpc.protocol.UserProcessor.ExecutorSelector getExecutorSelector() ,public com.alipay.remoting.BizContext preHandleRequest(com.alipay.remoting.Remotin...
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/protocol/RpcAsyncContext.java
RpcAsyncContext
sendResponse
class RpcAsyncContext implements AsyncContext { /** remoting context */ private RemotingContext ctx; /** rpc request command */ private RpcRequestCommand cmd; private RpcRequestProcessor processor; /** is response sent already */ private AtomicBoolean isResponseSentAlready = n...
if (isResponseSentAlready.compareAndSet(false, true)) { processor.sendResponseIfNecessary(this.ctx, cmd.getType(), processor .getCommandFactory().createResponse(responseObject, this.cmd)); } else { throw new IllegalStateException("Should not send rpc response rep...
401
85
486
<no_super_class>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/protocol/RpcCommandDecoder.java
RpcCommandDecoder
decode
class RpcCommandDecoder implements CommandDecoder { private static final Logger logger = BoltLoggerFactory.getLogger("RpcRemoting"); private int lessLen; { lessLen = RpcProtocol.getResponseHeaderLength() < RpcProtocol.getRequestHeaderLength() ? RpcProtocol .getResponse...
// the less length between response header and request header if (in.readableBytes() >= lessLen) { in.markReaderIndex(); byte protocol = in.readByte(); in.resetReaderIndex(); if (protocol == RpcProtocol.PROTOCOL_CODE) { /* ...
372
1,374
1,746
<no_super_class>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/protocol/RpcCommandEncoder.java
RpcCommandEncoder
encode
class RpcCommandEncoder implements CommandEncoder { /** logger */ private static final Logger logger = BoltLoggerFactory.getLogger("RpcRemoting"); /** * @see com.alipay.remoting.CommandEncoder#encode(io.netty.channel.ChannelHandlerContext, java.io.Serializable, io.netty.buffer.ByteBuf) */ @Ov...
try { if (msg instanceof RpcCommand) { /* * ver: version for protocol * type: request/response/request oneway * cmdcode: code for remoting command * ver2:version for remoting command * requestId: id...
134
530
664
<no_super_class>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/protocol/RpcCommandEncoderV2.java
RpcCommandEncoderV2
encode
class RpcCommandEncoderV2 implements CommandEncoder { /** logger */ private static final Logger logger = BoltLoggerFactory.getLogger("RpcRemoting"); /** * @see CommandEncoder#encode(ChannelHandlerContext, Serializable, ByteBuf) */ @Override public void encode(ChannelHandlerContext ctx, Se...
try { if (msg instanceof RpcCommand) { /* * proto: magic code for protocol * ver: version for protocol * type: request/response/request oneway * cmdcode: code for remoting command * ver2:version for...
109
763
872
<no_super_class>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/protocol/RpcCommandHandler.java
RpcCommandHandler
processExceptionForSingleCommand
class RpcCommandHandler implements CommandHandler { private static final Logger logger = BoltLoggerFactory.getLogger("RpcRemoting"); /** All processors */ ProcessorManager processorManager; CommandFactory commandFactory; /** * Constructor. Initialize the processor man...
final int id = ((RpcCommand) msg).getId(); final String emsg = "Exception caught when processing " + ((msg instanceof RequestCommand) ? "request, id=" : "response, id="); logger.warn(emsg + id, t); if (msg instanceof RequestCommand) { final Reques...
1,115
360
1,475
<no_super_class>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/protocol/RpcDeserializeLevel.java
RpcDeserializeLevel
valueOf
class RpcDeserializeLevel { /** deserialize clazz, header, contents all three parts of rpc command */ public final static int DESERIALIZE_ALL = 0x02; /** deserialize both header and clazz parts of rpc command */ public final static int DESERIALIZE_HEADER = 0x01; /** deserialize only the clazz par...
switch (value) { case 0x00: return "DESERIALIZE_CLAZZ"; case 0x01: return "DESERIALIZE_HEADER"; case 0x02: return "DESERIALIZE_ALL"; } throw new IllegalArgumentException("Unknown deserialize level value ," + val...
163
96
259
<no_super_class>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/protocol/RpcHeartBeatProcessor.java
RpcHeartBeatProcessor
doProcess
class RpcHeartBeatProcessor extends AbstractRemotingProcessor { private static final Logger logger = BoltLoggerFactory.getLogger("RpcRemoting"); @Override public void doProcess(final RemotingContext ctx, RemotingCommand msg) {<FILL_FUNCTION_BODY>} }
if (msg instanceof HeartbeatCommand) {// process the heartbeat final int id = msg.getId(); if (logger.isDebugEnabled()) { logger.debug("Heartbeat received! Id=" + id + ", from " + RemotingUtil.parseRemoteAddress(ctx.getChannelContext().channe...
76
511
587
<methods>public void <init>() ,public void <init>(com.alipay.remoting.CommandFactory) ,public void <init>(java.util.concurrent.ExecutorService) ,public void <init>(com.alipay.remoting.CommandFactory, java.util.concurrent.ExecutorService) ,public abstract void doProcess(com.alipay.remoting.RemotingContext, com.alipay.re...
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/protocol/RpcHeartbeatTrigger.java
RpcHeartbeatTrigger
heartbeatTriggered
class RpcHeartbeatTrigger implements HeartbeatTrigger { private static final Logger logger = BoltLoggerFactory.getLogger("RpcRemoting"); /** max trigger times */ public static final Integer maxCount = ConfigManager.tcp_idle_maxtimes(); private static final long heartbea...
Integer heartbeatTimes = ctx.channel().attr(Connection.HEARTBEAT_COUNT).get(); final Connection conn = ctx.channel().attr(Connection.CONNECTION).get(); if (heartbeatTimes >= maxCount) { try { conn.close(); logger.error( "Heartbeat ...
209
1,034
1,243
<no_super_class>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/protocol/RpcProtocolDecoder.java
RpcProtocolDecoder
decodeProtocolVersion
class RpcProtocolDecoder extends ProtocolCodeBasedDecoder { public static final int MIN_PROTOCOL_CODE_WITH_VERSION = 2; public RpcProtocolDecoder(int protocolCodeLength) { super(protocolCodeLength); } @Override protected byte decodeProtocolVersion(ByteBuf in) {<FILL_FUNCTION_BODY>} }
in.resetReaderIndex(); if (in.readableBytes() >= protocolCodeLength + DEFAULT_PROTOCOL_VERSION_LENGTH) { byte rpcProtocolCodeByte = in.readByte(); if (rpcProtocolCodeByte >= MIN_PROTOCOL_CODE_WITH_VERSION) { return in.readByte(); } } r...
95
108
203
<methods>public void <init>(int) <variables>public static final int DEFAULT_ILLEGAL_PROTOCOL_VERSION_LENGTH,public static final int DEFAULT_PROTOCOL_VERSION_LENGTH,protected int protocolCodeLength
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/protocol/RpcRequestCommand.java
RpcRequestCommand
deserializeHeader
class RpcRequestCommand extends RequestCommand { /** For serialization */ private static final long serialVersionUID = -4602613826188210946L; private Object requestObject; private String requestClass; private CustomSerializer customSerializer; private Object ...
if (this.getHeader() != null && this.getRequestHeader() == null) { if (this.getCustomSerializer() != null) { try { this.getCustomSerializer().deserializeHeader(this); } catch (DeserializationException e) { throw e; ...
1,898
123
2,021
<methods>public void <init>() ,public void <init>(com.alipay.remoting.CommandCode) ,public void <init>(byte, com.alipay.remoting.CommandCode) ,public void <init>(byte, byte, com.alipay.remoting.CommandCode) ,public int getTimeout() ,public void setTimeout(int) <variables>private static final long serialVersionUID,priva...
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/protocol/RpcResponseCommand.java
RpcResponseCommand
deserializeContent
class RpcResponseCommand extends ResponseCommand { /** For serialization */ private static final long serialVersionUID = 5667111367880018776L; private Object responseObject; private String responseClass; private CustomSerializer customSerializer; private Object ...
if (this.getResponseObject() == null) { try { if (this.getCustomSerializer() != null && this.getCustomSerializer().deserializeContent(this, invokeContext)) { return; } if (this.getContent() != null) { ...
1,588
175
1,763
<methods>public void <init>() ,public void <init>(com.alipay.remoting.CommandCode) ,public void <init>(int) ,public void <init>(com.alipay.remoting.CommandCode, int) ,public void <init>(byte, byte, com.alipay.remoting.CommandCode, int) ,public java.lang.Throwable getCause() ,public java.net.InetSocketAddress getRespons...
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/protocol/RpcResponseProcessor.java
RpcResponseProcessor
doProcess
class RpcResponseProcessor extends AbstractRemotingProcessor<RemotingCommand> { private static final Logger logger = BoltLoggerFactory.getLogger("RpcRemoting"); /** * Default constructor. */ public RpcResponseProcessor() { } /** * Constructor. */ public RpcResponseProcess...
Connection conn = ctx.getChannelContext().channel().attr(Connection.CONNECTION).get(); InvokeFuture future = conn.removeInvokeFuture(cmd.getId()); ClassLoader oldClassLoader = null; try { if (future != null) { if (future.getAppClassLoader() != null) { ...
168
287
455
<methods>public void <init>() ,public void <init>(com.alipay.remoting.CommandFactory) ,public void <init>(java.util.concurrent.ExecutorService) ,public void <init>(com.alipay.remoting.CommandFactory, java.util.concurrent.ExecutorService) ,public abstract void doProcess(com.alipay.remoting.RemotingContext, com.alipay.re...
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/protocol/SyncMultiInterestUserProcessor.java
SyncMultiInterestUserProcessor
handleRequest
class SyncMultiInterestUserProcessor<T> extends AbstractMultiInterestUserProcessor<T> { /** * @see com.alipay.remoting.rpc.protocol.UserProcessor#handleRequest(com.alipay.remoting.BizContext, java.lang.Object) */ @Override public abstract Ob...
throw new UnsupportedOperationException( "ASYNC handle request is unsupported in SyncMultiInterestUserProcessor!");
268
32
300
<methods>public non-sealed void <init>() ,public java.lang.String interest() <variables>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/protocol/SyncUserProcessor.java
SyncUserProcessor
handleRequest
class SyncUserProcessor<T> extends AbstractUserProcessor<T> { /** * @see com.alipay.remoting.rpc.protocol.UserProcessor#handleRequest(com.alipay.remoting.BizContext, java.lang.Object) */ @Override public abstract Object handleRequest(BizContext bizCtx, T request) throws Exception; /** * ...
throw new UnsupportedOperationException( "ASYNC handle request is unsupported in SyncUserProcessor!");
252
30
282
<methods>public non-sealed void <init>() ,public java.lang.ClassLoader getBizClassLoader() ,public java.util.concurrent.Executor getExecutor() ,public com.alipay.remoting.rpc.protocol.UserProcessor.ExecutorSelector getExecutorSelector() ,public com.alipay.remoting.BizContext preHandleRequest(com.alipay.remoting.Remotin...
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/rpc/protocol/UserProcessorRegisterHelper.java
UserProcessorRegisterHelper
registerUserProcessor
class UserProcessorRegisterHelper { /** * Help register single-interest user processor. * * @param processor the processor need to be registered * @param userProcessors the map of user processors */ public static void registerUserProcessor(UserProcessor<?> processor, ...
if (null == processor.multiInterest() || processor.multiInterest().isEmpty()) { throw new RuntimeException("Processor interest should not be blank!"); } for (String interest : processor.multiInterest()) { UserProcessor<?> preProcessor = userProcessors.putIfAbsent(interes...
388
141
529
<no_super_class>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/serialization/HessianSerializer.java
HessianSerializer
serialize
class HessianSerializer implements Serializer { private SerializerFactory serializerFactory = new SerializerFactory(); private static ThreadLocal<ByteArrayOutputStream> localOutputByteArray = new ThreadLocal<ByteArrayOutputStream>() { ...
ByteArrayOutputStream byteArray = localOutputByteArray.get(); byteArray.reset(); Hessian2Output output = new Hessian2Output(byteArray); output.setSerializerFactory(serializerFactory); try { output.writeObject(obj); output.close(); } catch (IOExcep...
348
118
466
<no_super_class>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/serialization/SerializerManager.java
SerializerManager
addSerializer
class SerializerManager { private static Serializer[] serializers = new Serializer[5]; public static final byte Hessian2 = 1; //public static final byte Json = 2; private static final ReentrantLock REENTRANT_LOCK = new ReentrantLock(); public static Serializer ...
if (serializers.length <= idx) { Serializer[] newSerializers = new Serializer[idx + 5]; System.arraycopy(serializers, 0, newSerializers, 0, serializers.length); serializers = newSerializers; } serializers[idx] = serializer;
243
80
323
<no_super_class>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/util/ConnectionUtil.java
ConnectionUtil
getConnectionFromChannel
class ConnectionUtil { public static Connection getConnectionFromChannel(Channel channel) {<FILL_FUNCTION_BODY>} public static void addIdPoolKeyMapping(Integer id, String group, Channel channel) { Connection connection = getConnectionFromChannel(channel); if (connection != null) { ...
if (channel == null) { return null; } Attribute<Connection> connAttr = channel.attr(Connection.CONNECTION); if (connAttr != null) { Connection connection = connAttr.get(); return connection; } return null;
360
75
435
<no_super_class>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/util/CrcUtil.java
CrcUtil
crc32
class CrcUtil { private static final ThreadLocal<CRC32> CRC_32_THREAD_LOCAL = new ThreadLocal<CRC32>() { @Override protected CRC32 initialValue() { ...
CRC32 crc32 = CRC_32_THREAD_LOCAL.get(); crc32.update(array, offset, length); int ret = (int) crc32.getValue(); crc32.reset(); return ret;
253
72
325
<no_super_class>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/util/FutureTaskUtil.java
FutureTaskUtil
launderThrowable
class FutureTaskUtil { /** * get the result of a future task * * Notice: the run method of this task should have been called at first. * * @param task * @param <T> * @return */ public static <T> T getFutureTaskResult(RunStateRecordedFutureTask<T> task, Logger logger) { ...
if (t instanceof RuntimeException) { throw (RuntimeException) t; } else if (t instanceof Error) { throw (Error) t; } else { throw new IllegalStateException("Not unchecked!", t); }
298
64
362
<no_super_class>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/util/IoUtils.java
IoUtils
closeQuietly
class IoUtils { public static void closeQuietly(Closeable closeable) {<FILL_FUNCTION_BODY>} }
try { if (closeable != null) { closeable.close(); } } catch (IOException e) { // NOPMD // ignore }
35
48
83
<no_super_class>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/util/NettyEventLoopUtil.java
NettyEventLoopUtil
newEventLoopGroup
class NettyEventLoopUtil { /** check whether epoll enabled, and it would not be changed during runtime. */ private static boolean epollEnabled = ConfigManager.netty_epoll() && Epoll.isAvailable(); /** * Create the right event loop according to current platform and system property, fallback to NIO whe...
return epollEnabled ? new EpollEventLoopGroup(nThreads, threadFactory) : new NioEventLoopGroup(nThreads, threadFactory);
490
41
531
<no_super_class>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/util/RemotingUtil.java
RemotingUtil
parseRemoteAddress
class RemotingUtil { /** * Parse the remote address of the channel. * * @param channel * @return */ public static String parseRemoteAddress(final Channel channel) {<FILL_FUNCTION_BODY>} /** * Parse the local address of the channel. * * @param channel * @retur...
if (null == channel) { return StringUtils.EMPTY; } final SocketAddress remote = channel.remoteAddress(); return doParse(remote != null ? remote.toString().trim() : StringUtils.EMPTY);
1,420
63
1,483
<no_super_class>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/util/RunStateRecordedFutureTask.java
RunStateRecordedFutureTask
getAfterRun
class RunStateRecordedFutureTask<V> extends FutureTask<V> { private AtomicBoolean hasRun = new AtomicBoolean(); public RunStateRecordedFutureTask(Callable<V> callable) { super(callable); } @Override public void run() { this.hasRun.set(true); super.run(); } public V...
if (!hasRun.get()) { throw new FutureTaskNotRunYetException(); } if (!isDone()) { throw new FutureTaskNotCompleted(); } return super.get();
141
57
198
<methods>public void <init>(Callable<V>) ,public void <init>(java.lang.Runnable, V) ,public boolean cancel(boolean) ,public V get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException,public V get(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException, java.util.concurrent...
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/util/StringUtils.java
StringUtils
splitWorker
class StringUtils { public static final String EMPTY = ""; public static final String[] EMPTY_STRING_ARRAY = new String[0]; // Empty checks //----------------------------------------------------------------------- public static boolean isEmpty(CharSequence cs) { return cs =...
// Performance tuned for 2.0 (JDK1.4) if (str == null) { return null; } final int len = str.length(); if (len == 0) { return EMPTY_STRING_ARRAY; } final List<String> list = new ArrayList<String>(); int i = 0, start = 0; bo...
495
266
761
<no_super_class>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/util/ThreadLocalArriveTimeHolder.java
ThreadLocalArriveTimeHolder
getArriveTimeMap
class ThreadLocalArriveTimeHolder { private static FastThreadLocal<WeakHashMap<Channel, Map<Integer, Long>>> arriveTimeInNano = new FastThreadLocal<WeakHashMap<Channel, Map<Integer, Long>>>(); public static void arrive(Channel channel, Integer key) { Map<Integer, Long> map = getArriveTimeMap(channel);...
WeakHashMap<Channel, Map<Integer, Long>> map = arriveTimeInNano.get(); if (map == null) { arriveTimeInNano.set(new WeakHashMap<Channel, Map<Integer, Long>>(256)); map = arriveTimeInNano.get(); } Map<Integer, Long> subMap = map.get(channel); if (subMap == ...
230
137
367
<no_super_class>
sofastack_sofa-bolt
sofa-bolt/src/main/java/com/alipay/remoting/util/TraceLogUtil.java
TraceLogUtil
printConnectionTraceLog
class TraceLogUtil { /** * print trace log * @param traceId * @param invokeContext */ public static void printConnectionTraceLog(Logger logger, String traceId, InvokeContext invokeContext) {<FILL_FUNCTION_BODY>} }
String sourceIp = invokeContext.get(InvokeContext.CLIENT_LOCAL_IP); Integer sourcePort = invokeContext.get(InvokeContext.CLIENT_LOCAL_PORT); String targetIp = invokeContext.get(InvokeContext.CLIENT_REMOTE_IP); Integer targetPort = invokeContext.get(InvokeContext.CLIENT_REMOTE_PORT); ...
74
205
279
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-actuator-autoconfigure/src/main/java/com/alipay/sofa/boot/actuator/autoconfigure/health/ReadinessAutoConfiguration.java
ReadinessAutoConfiguration
healthCheckerProcessor
class ReadinessAutoConfiguration { private static final Logger LOGGER = SofaBootLoggerFactory .getLogger(ReadinessAutoConfiguration.class); @Bean @ConditionalOnMissingBean(value = ReadinessCheckListener.class) public ReadinessCheckListener readinessCheckListe...
HealthCheckerProcessor healthCheckerProcessor = new HealthCheckerProcessor(); healthCheckerProcessor.setHealthCheckExecutor(readinessHealthCheckExecutor); healthCheckerProcessor.setParallelCheck(healthCheckProperties.isParallelCheck()); healthCheckerProcessor.setParallelCheckTimeout(hea...
1,064
142
1,206
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-actuator/src/main/java/com/alipay/sofa/boot/actuator/beans/IsleBeansEndpoint.java
IsleBeansEndpoint
getModuleApplicationContexts
class IsleBeansEndpoint extends BeansEndpoint { private final ApplicationRuntimeModel applicationRuntimeModel; /** * Creates a new {@code BeansEndpoint} that will describe the beans in the given * {@code context} and all of its ancestors. * * @param context the application context * @...
Map<String, BeansEndpoint.ContextBeansDescriptor> contexts = new HashMap<>(); List<DeploymentDescriptor> installedModules = applicationRuntimeModel.getInstalled(); installedModules.forEach(descriptor -> { ApplicationContext applicationContext = descriptor.getApplicationContext(); ...
684
160
844
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-actuator/src/main/java/com/alipay/sofa/boot/actuator/components/ComponentsEndpoint.java
ComponentsEndpoint
components
class ComponentsEndpoint { private final SofaRuntimeContext sofaRuntimeContext; /** * Creates a new {@code SofaBootComponentsEndPoint} that will describe the components in the {@link SofaRuntimeContext} * * @param sofaRuntimeContext the sofa runtime context */ public ComponentsEndpoint...
ComponentManager componentManager = sofaRuntimeContext.getComponentManager(); Map<String, Collection<ComponentDisplayInfo>> componentsInfoMap = new HashMap<>(); Collection<ComponentType> componentTypes = componentManager.getComponentTypes(); componentTypes.forEach(componentType -> { ...
528
269
797
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-actuator/src/main/java/com/alipay/sofa/boot/actuator/health/ComponentHealthChecker.java
ComponentHealthChecker
isHealthy
class ComponentHealthChecker implements HealthChecker { public static final String COMPONENT_NAME = "components"; private final SofaRuntimeContext sofaRuntimeContext; public ComponentHealthChecker(SofaRuntimeContext sofaRuntimeContext) { this.sofaRuntimeContext = sofaRuntimeContext; } ...
boolean allPassed = true; Health.Builder builder = new Health.Builder(); for (ComponentInfo componentInfo : sofaRuntimeContext.getComponentManager().getComponents()) { HealthResult healthy = componentInfo.isHealthy(); String healthReport = healthy.getHealthReport(); ...
238
175
413
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-actuator/src/main/java/com/alipay/sofa/boot/actuator/health/HealthCheckComparatorSupport.java
HealthCheckComparatorSupport
sortMapAccordingToValue
class HealthCheckComparatorSupport { public static Comparator<Object> getComparatorToUse(BeanFactory beanFactory) { Comparator<Object> comparatorToUse = null; if (beanFactory instanceof DefaultListableBeanFactory) { comparatorToUse = ((DefaultListableBeanFactory) beanFactory).getDepende...
List<Map.Entry<T, U>> entryList = new ArrayList<>(origin.entrySet()); entryList.sort((o1, o2) -> comparatorToUse.compare(o1.getValue(), o2.getValue())); LinkedHashMap<T, U> result = new LinkedHashMap<>(); for (Map.Entry<T, U> entry : entryList) { result.put(entry.getKey(), ...
307
119
426
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-actuator/src/main/java/com/alipay/sofa/boot/actuator/health/ModuleHealthChecker.java
ModuleHealthChecker
isHealthy
class ModuleHealthChecker implements HealthChecker { public static final String COMPONENT_NAME = "modules"; private final ApplicationRuntimeModel applicationRuntimeModel; public ModuleHealthChecker(ApplicationRuntimeModel applicationRuntimeModel) { this.applicationRuntimeModel = applic...
Health.Builder builder = new Health.Builder(); for (DeploymentDescriptor deploymentDescriptor : applicationRuntimeModel.getFailed()) { builder.withDetail(deploymentDescriptor.getName(), "failed"); } if (applicationRuntimeModel.getFailed().size() == 0) { return ...
232
106
338
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-actuator/src/main/java/com/alipay/sofa/boot/actuator/health/ReadinessCheckCallbackProcessor.java
ReadinessCheckCallbackProcessor
readinessCheckCallback
class ReadinessCheckCallbackProcessor implements ApplicationContextAware { private static final Logger logger = SofaBootLoggerFactory .getLogger(ReadinessChec...
logger.info("Begin ReadinessCheckCallback readiness check"); Assert.notNull(readinessCheckCallbacks, "ReadinessCheckCallbacks must not be null."); boolean allResult = true; String failedBeanId = ""; for (Map.Entry<String, ReadinessCheckCallback> entry : readinessCheckCallbacks....
807
285
1,092
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-actuator/src/main/java/com/alipay/sofa/boot/actuator/health/ReadinessEndpoint.java
ReadinessEndpoint
health
class ReadinessEndpoint { private final ReadinessCheckListener readinessCheckListener; public ReadinessEndpoint(ReadinessCheckListener readinessCheckListener) { this.readinessCheckListener = readinessCheckListener; } @ReadOperation public Health health(@Nullable String showDetail) {<FILL_...
Health health = readinessCheckListener.aggregateReadinessHealth(); if (showDetail == null || Boolean.parseBoolean(showDetail)) { return health; } return new Health.Builder(health.getStatus()).build();
87
61
148
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-actuator/src/main/java/com/alipay/sofa/boot/actuator/health/ReadinessHttpCodeStatusMapper.java
ReadinessHttpCodeStatusMapper
getUniformMappings
class ReadinessHttpCodeStatusMapper implements HttpCodeStatusMapper { private static final Map<String, Integer> DEFAULT_MAPPINGS; static { Map<String, Integer> defaultMappings = new HashMap<>(8); defaultMappings.put(Status.DOWN.getCode(), WebEndpointResponse.STATUS_SERVICE_UNAVAILABLE); ...
Map<String, Integer> result = new LinkedHashMap<>(); for (Map.Entry<String, Integer> entry : mappings.entrySet()) { String code = getUniformCode(entry.getKey()); if (code != null) { result.putIfAbsent(code, entry.getValue()); } } retur...
520
99
619
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-actuator/src/main/java/com/alipay/sofa/boot/actuator/isle/IsleEndpoint.java
IsleEndpoint
createBaseModuleInfo
class IsleEndpoint { private final ApplicationRuntimeModel applicationRuntimeModel; public IsleEndpoint(ApplicationRuntimeModel applicationRuntimeModel) { this.applicationRuntimeModel = applicationRuntimeModel; } @ReadOperation public IsleDescriptor modules() { // already installe...
ModuleDisplayInfo moduleDisplayInfo = new ModuleDisplayInfo(); moduleDisplayInfo.setName(dd.getModuleName()); moduleDisplayInfo.setResourceName(dd.getName()); moduleDisplayInfo.setSpringParent(dd.getSpringParent()); moduleDisplayInfo.setRequireModules(dd.getRequiredModules()); ...
989
175
1,164
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-actuator/src/main/java/com/alipay/sofa/boot/actuator/rpc/RpcAfterHealthCheckCallback.java
RpcAfterHealthCheckCallback
onHealthy
class RpcAfterHealthCheckCallback implements ReadinessCheckCallback, PriorityOrdered { private final RpcStartApplicationListener rpcStartApplicationListener; public RpcAfterHealthCheckCallback(RpcStartApplicationListener rpcStartApplicationListener) { this.rpcStartApplicationListener = rpcStartApplica...
Health.Builder builder = new Health.Builder(); rpcStartApplicationListener.publishRpcStartEvent(); if (rpcStartApplicationListener.isSuccess()) { return builder.status(Status.UP).build(); } else { return builder.status(Status.DOWN).withDetail("Reason", "Rpc ser...
143
96
239
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-actuator/src/main/java/com/alipay/sofa/boot/actuator/threadpool/ThreadPoolEndpoint.java
ThreadPoolEndpoint
threadPools
class ThreadPoolEndpoint { private final ThreadPoolGovernor threadPoolGovernor; public ThreadPoolEndpoint(ThreadPoolGovernor threadPoolGovernor) { this.threadPoolGovernor = threadPoolGovernor; } @ReadOperation public ThreadPoolsDescriptor threadPools () {<FILL_FUNCTION_BODY>} private...
Collection<ThreadPoolMonitorWrapper> threadPoolWrappers = threadPoolGovernor.getAllThreadPoolWrappers(); List<ThreadPoolInfo> threadPoolInfoList = threadPoolWrappers.stream().map(this::convertToThreadPoolInfo).toList(); return new ThreadPoolsDescriptor(threadPoolInfoList);
451
80
531
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-autoconfigure/src/main/java/com/alipay/sofa/boot/autoconfigure/ark/SofaArkAutoConfiguration.java
SofaArkAutoConfiguration
sofaRuntimeContainer
class SofaArkAutoConfiguration { @Bean @ConditionalOnMissingBean public SofaRuntimeContainer sofaRuntimeContainer(SofaRuntimeManager sofaRuntimeManager, SofaArkProperties sofaArkProperties) {<FILL_FUNCTION_BODY>} @Bean @ConditionalOnMissingBean ...
SofaRuntimeContainer sofaRuntimeContainer = new SofaRuntimeContainer(sofaRuntimeManager); sofaRuntimeContainer.setJvmServiceCache(sofaArkProperties.isJvmServiceCache()); sofaRuntimeContainer.setJvmInvokeSerialize(sofaArkProperties.isJvmInvokeSerialize()); return sofaRuntimeContainer; ...
115
85
200
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-autoconfigure/src/main/java/com/alipay/sofa/boot/autoconfigure/condition/OnMasterBizCondition.java
OnMasterBizCondition
getMatchOutcome
class OnMasterBizCondition extends SpringBootCondition { private static Object masterBiz; @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {<FILL_FUNCTION_BODY>} private List<AnnotationAttributes> annotationAttributesFromMultiValueMap( ...
// 非 Ark 环境 if (!SofaBootEnvUtils.isArkEnv()) { return new ConditionOutcome(true, "SOFAArk has not started."); } if (masterBiz == null) { String masterBizName = ArkConfigs.getStringValue(Constants.MASTER_BIZ); List<Biz> biz = ArkClient.getBizManagerS...
350
419
769
<methods>public void <init>() ,public abstract org.springframework.boot.autoconfigure.condition.ConditionOutcome getMatchOutcome(org.springframework.context.annotation.ConditionContext, org.springframework.core.type.AnnotatedTypeMetadata) ,public final boolean matches(org.springframework.context.annotation.ConditionCon...
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-autoconfigure/src/main/java/com/alipay/sofa/boot/autoconfigure/condition/OnSwitchCondition.java
OnSwitchCondition
getClassOrMethodName
class OnSwitchCondition extends SpringBootCondition { private static final String CONFIG_KEY_PREFIX = "sofa.boot.switch.bean"; @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { return getMatchOutcome(context.getEnvironment(), metadata); ...
if (metadata instanceof ClassMetadata classMetadata) { return classMetadata.getClassName(); } MethodMetadata methodMetadata = (MethodMetadata) metadata; return methodMetadata.getMethodName();
472
51
523
<methods>public void <init>() ,public abstract org.springframework.boot.autoconfigure.condition.ConditionOutcome getMatchOutcome(org.springframework.context.annotation.ConditionContext, org.springframework.core.type.AnnotatedTypeMetadata) ,public final boolean matches(org.springframework.context.annotation.ConditionCon...
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-autoconfigure/src/main/java/com/alipay/sofa/boot/autoconfigure/condition/OnTestCondition.java
OnTestCondition
getMatchOutcome
class OnTestCondition extends SpringBootCondition { @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {<FILL_FUNCTION_BODY>} }
ConditionMessage matchMessage = ConditionMessage.empty(); if (metadata.isAnnotated(ConditionalOnNotTest.class.getName())) { if (SofaBootEnvUtils.isSpringTestEnv()) { return ConditionOutcome.noMatch(ConditionMessage.forCondition( ConditionalOnNotTest.class...
52
135
187
<methods>public void <init>() ,public abstract org.springframework.boot.autoconfigure.condition.ConditionOutcome getMatchOutcome(org.springframework.context.annotation.ConditionContext, org.springframework.core.type.AnnotatedTypeMetadata) ,public final boolean matches(org.springframework.context.annotation.ConditionCon...
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-autoconfigure/src/main/java/com/alipay/sofa/boot/autoconfigure/detect/LegacyAutoConfigurationDetectListener.java
LegacyAutoConfigurationDetectListener
onAutoConfigurationImportEvent
class LegacyAutoConfigurationDetectListener implements AutoConfigurationImportListener, BeanClassLoaderAware { private static final Logger LOGGER = SofaBootLoggerFactory .getLogger(LegacyAutoConfigurationDetectListener.cla...
// configurations form *.import file Set<String> importConfigurations = new HashSet<>(); importConfigurations.addAll(event.getCandidateConfigurations()); importConfigurations.addAll(event.getExclusions()); // configurations from spring.factories file List<String> config...
258
223
481
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-autoconfigure/src/main/java/com/alipay/sofa/boot/autoconfigure/isle/SofaModuleAutoConfiguration.java
SofaModuleAutoConfiguration
modelCreatingStage
class SofaModuleAutoConfiguration { private static final Logger LOGGER = SofaBootLoggerFactory .getLogger(SofaModuleAutoConfiguration.class); @Bean @ConditionalOnMissingBean public PipelineContext pipelineContext(List<PipelineStage> stageList) { Pipel...
ModelCreatingStage modelCreatingStage = new ModelCreatingStage(); sofaModuleProperties.getIgnoreModules().forEach(modelCreatingStage::addIgnoreModule); sofaModuleProperties.getIgnoreCalculateRequireModules().forEach(modelCreatingStage::addIgnoredCalculateRequireModule); modelCreatingSta...
1,798
129
1,927
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-autoconfigure/src/main/java/com/alipay/sofa/boot/autoconfigure/rpc/RegistryConfigurations.java
RegistryConfigurations
registryConfigurationClass
class RegistryConfigurations { public static String[] registryConfigurationClass() {<FILL_FUNCTION_BODY>} }
return new String[] { LocalRegistryConfiguration.class.getName(), ZookeeperRegistryConfiguration.class.getName(), NacosRegistryConfiguration.class.getName(), MulticastRegistryConfiguration.class.getName(), MeshRegistryConfiguration.class.getName()...
34
113
147
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-autoconfigure/src/main/java/com/alipay/sofa/boot/autoconfigure/rpc/RestFilterConfiguration.java
RestFilterConfiguration
clientRequestFilters
class RestFilterConfiguration { @Bean @ConditionalOnMissingBean public ContainerRequestFilterContainer containerRequestFilters(List<ContainerRequestFilter> containerRequestFilters) { for (ContainerRequestFilter filter : containerRequestFilters) { JAXRSProviderManager.registerCustomProv...
for (ClientRequestFilter filter : clientRequestFilters) { JAXRSProviderManager.registerCustomProviderInstance(filter); } return new ClientRequestFilterContainer(clientRequestFilters);
589
50
639
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-autoconfigure/src/main/java/com/alipay/sofa/boot/autoconfigure/runtime/SofaRuntimeAutoConfiguration.java
SofaRuntimeAutoConfiguration
sofaRuntimeManager
class SofaRuntimeAutoConfiguration { private static final Logger LOGGER = SofaBootLoggerFactory .getLogger(SofaRuntimeAutoConfiguration.class); @Bean @ConditionalOnMissingBean public static SofaRuntimeManager sofaRuntimeManager(Environment environment, ...
ClientFactoryInternal clientFactoryInternal = new ClientFactoryImpl(); SofaRuntimeManager sofaRuntimeManager = new StandardSofaRuntimeManager( environment.getProperty(SofaBootConstants.APP_NAME_KEY), Thread.currentThread() .getContextClassLoader(), clientFactoryInternal); ...
1,205
315
1,520
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-autoconfigure/src/main/java/com/alipay/sofa/boot/autoconfigure/tracer/SofaTracerAutoConfiguration.java
SofaTracerAutoConfiguration
sofaTracerSpanReportListener
class SofaTracerAutoConfiguration { @Bean @ConditionalOnMissingBean public SpanReportListenerHolder sofaTracerSpanReportListener(List<SpanReportListener> spanReportListenerList) {<FILL_FUNCTION_BODY>} }
if (!CollectionUtils.isEmpty(spanReportListenerList)) { //cache in tracer listener core SpanReportListenerHolder.addSpanReportListeners(spanReportListenerList); } return null;
64
54
118
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-autoconfigure/src/main/java/com/alipay/sofa/boot/autoconfigure/tracer/SofaTracerConfigurationListener.java
SofaTracerConfigurationListener
onApplicationEvent
class SofaTracerConfigurationListener implements ApplicationListener<ApplicationEnvironmentPreparedEvent>, Ordered { @Override public void onApplicationEvent(ApplicationEnvironmen...
if (SofaBootEnvUtils.isSpringCloudBootstrapEnvironment(event.getEnvironment())) { return; } ConfigurableEnvironment environment = event.getEnvironment(); // check spring.application.name String applicationName = environment.getProperty(SofaBootConstants.APP_NAME_KE...
107
878
985
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-autoconfigure/src/main/java/com/alipay/sofa/boot/autoconfigure/tracer/datasource/DataSourceAutoConfiguration.java
DataSourceAutoConfiguration
dataSourceBeanPostProcessor
class DataSourceAutoConfiguration { @Bean @ConditionalOnMissingBean public static DataSourceBeanPostProcessor dataSourceBeanPostProcessor(Environment environment) {<FILL_FUNCTION_BODY>} }
String appName = environment.getProperty(SofaTracerConfiguration.TRACER_APPNAME_KEY); DataSourceBeanPostProcessor dataSourceBeanPostProcessor = new DataSourceBeanPostProcessor(); dataSourceBeanPostProcessor.setAppName(appName); return dataSourceBeanPostProcessor;
53
74
127
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-autoconfigure/src/main/java/com/alipay/sofa/boot/autoconfigure/tracer/flexible/FlexibleAutoConfiguration.java
FlexibleAutoConfiguration
sofaTracer
class FlexibleAutoConfiguration { @Bean @ConditionalOnMissingBean public Tracer sofaTracer(ObjectProvider<SofaTracerProperties> sofaTracerPropertiesObjectProvider) throws Exception {<FILL_FUNCTION_BODY>} ...
SofaTracerProperties sofaTracerProperties = sofaTracerPropertiesObjectProvider .getIfUnique(); String reporterName = null; if (sofaTracerProperties != null) { reporterName = sofaTracerProperties.getReporterName(); } if (StringUtils.hasText(reporterName)) ...
255
158
413
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-autoconfigure/src/main/java/com/alipay/sofa/boot/autoconfigure/tracer/mongo/MongoAutoConfiguration.java
MongoAutoConfiguration
sofaTracerMongoClientSettingsBuilderCustomizer
class MongoAutoConfiguration { @Bean @ConditionalOnMissingBean public SofaTracerCommandListenerCustomizer sofaTracerMongoClientSettingsBuilderCustomizer(Environment environment) {<FILL_FUNCTION_BODY>} }
String appName = environment.getProperty(SofaTracerConfiguration.TRACER_APPNAME_KEY); SofaTracerCommandListenerCustomizer sofaTracerCommandListenerCustomizer = new SofaTracerCommandListenerCustomizer(); sofaTracerCommandListenerCustomizer.setAppName(appName); return sofaTracerCommandLis...
61
88
149
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-autoconfigure/src/main/java/com/alipay/sofa/boot/autoconfigure/tracer/rocketmq/RocketMqAutoConfiguration.java
RocketMqAutoConfiguration
sofaTracerRocketMqConsumerPostProcessor
class RocketMqAutoConfiguration { @Bean @ConditionalOnMissingBean public static RocketMqProducerPostProcessor sofaTracerRocketMqProducerPostProcessor(Environment environment) { String appName = environment.getProperty(SofaTracerConfiguration.TRACER_APPNAME_KEY); RocketMqProducerPostProcesso...
String appName = environment.getProperty(SofaTracerConfiguration.TRACER_APPNAME_KEY); RocketMqConsumerPostProcessor rocketMqConsumerPostProcessor = new RocketMqConsumerPostProcessor(); rocketMqConsumerPostProcessor.setAppName(appName); return rocketMqConsumerPostProcessor;
192
84
276
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-autoconfigure/src/main/java/com/alipay/sofa/boot/autoconfigure/tracer/springmessage/SpringMessageAutoConfiguration.java
SpringMessageAutoConfiguration
springMessageTracerBeanPostProcessor
class SpringMessageAutoConfiguration { @Bean @ConditionalOnMissingBean public static SpringMessageTracerBeanPostProcessor springMessageTracerBeanPostProcessor(Environment environment) {<FILL_FUNCTION_BODY>} }
String appName = environment.getProperty(SofaTracerConfiguration.TRACER_APPNAME_KEY); SpringMessageTracerBeanPostProcessor springMessageTracerBeanPostProcessor = new SpringMessageTracerBeanPostProcessor(); springMessageTracerBeanPostProcessor.setAppName(appName); return springMessageTra...
57
84
141
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-autoconfigure/src/main/java/com/alipay/sofa/boot/autoconfigure/tracer/springmvc/OpenTracingSpringMvcAutoConfiguration.java
SpringMvcDelegatingFilterProxyConfiguration
springMvcSofaTracerFilter
class SpringMvcDelegatingFilterProxyConfiguration { @Bean public FilterRegistrationBean<SpringMvcSofaTracerFilter> springMvcSofaTracerFilter(OpenTracingSpringMvcProperties openTracingSpringMvcProperties) {<FILL_FUNCTION_BODY>} }
FilterRegistrationBean<SpringMvcSofaTracerFilter> filterRegistrationBean = new FilterRegistrationBean<>(); SpringMvcSofaTracerFilter filter = new SpringMvcSofaTracerFilter(); filterRegistrationBean.setFilter(filter); List<String> urlPatterns = openTracingSpringMvcPropert...
79
212
291
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-autoconfigure/src/main/java/com/alipay/sofa/boot/autoconfigure/tracer/zipkin/ZipkinAutoConfiguration.java
ZipkinAutoConfiguration
zipkinSofaTracerSpanReporter
class ZipkinAutoConfiguration { @Bean @ConditionalOnMissingBean public ZipkinSofaTracerRestTemplateCustomizer zipkinSofaTracerRestTemplateCustomizer(ZipkinProperties zipkinProperties) { return new ZipkinSofaTracerRestTemplateCustomizer(zipkinProperties.isGzipped()); } @Bean @Conditiona...
RestTemplate restTemplate = new RestTemplate(); zipkinSofaTracerRestTemplateCustomizer.customize(restTemplate); return new ZipkinSofaTracerSpanRemoteReporter(restTemplate, zipkinProperties.getBaseUrl());
175
62
237
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/ark-sofa-boot/src/main/java/com/alipay/sofa/boot/ark/SofaRuntimeActivator.java
SofaRuntimeActivator
registerEventHandler
class SofaRuntimeActivator implements PluginActivator { @Override public void start(PluginContext context) { registerEventHandler(context); context.publishService(DynamicJvmServiceProxyFinder.class, DynamicJvmServiceProxyFinder.getInstance()); } private void registerEventHa...
EventAdminService eventAdminService = context.referenceService(EventAdminService.class) .getService(); eventAdminService.register(new SofaBizUninstallEventHandler()); eventAdminService.register(new SofaBizHealthCheckEventHandler()); eventAdminService.register(new FinishStart...
126
100
226
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/ark-sofa-boot/src/main/java/com/alipay/sofa/boot/ark/handler/SofaBizHealthCheckEventHandler.java
SofaBizHealthCheckEventHandler
doHealthCheck
class SofaBizHealthCheckEventHandler implements EventHandler<AfterBizStartupEvent> { private static final String READINESS_CHECK_LISTENER_CLASS = "com.alipay.sofa.boot.actuator.health.ReadinessCheckListener"; private static boolean isReadinessCheckListenerClassExist; static { try { ...
if (!isReadinessCheckListenerClassExist) { return; } ApplicationContext applicationContext = SofaRuntimeContainer.getApplicationContext(biz .getBizClassLoader()); if (applicationContext == null) { throw new IllegalStateException("No application matc...
248
187
435
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/ark-sofa-boot/src/main/java/com/alipay/sofa/boot/ark/handler/SofaBizUninstallEventHandler.java
SofaBizUninstallEventHandler
doUninstallBiz
class SofaBizUninstallEventHandler implements EventHandler<BeforeBizStopEvent> { @Override public void handleEvent(BeforeBizStopEvent event) { doUninstallBiz(event.getSource()); } private void doUninstallBiz(Biz biz) {<FILL_FUNCTION_BODY>} @Override public int getPriority() { ...
// Remove dynamic JVM service cache DynamicJvmServiceProxyFinder.getInstance().afterBizUninstall(biz); SofaRuntimeManager sofaRuntimeManager = SofaRuntimeContainer.getSofaRuntimeManager(biz .getBizClassLoader()); if (sofaRuntimeManager == null) { throw new Ille...
120
117
237
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/ark-sofa-boot/src/main/java/com/alipay/sofa/boot/ark/invoke/DynamicJvmServiceInvoker.java
DynamicJvmServiceInvoker
hessianTransport
class DynamicJvmServiceInvoker extends ServiceProxy { private static final Logger LOGGER = SofaBootLoggerFactory .getLogger(DynamicJvmServiceInvoker.class); private final Contract contract; private final Object targetService;...
Object target; ClassLoader currentContextClassloader = Thread.currentThread().getContextClassLoader(); try { if (contextClassLoader != null) { Thread.currentThread().setContextClassLoader(contextClassLoader); } SerializerFactory serializerFact...
1,101
267
1,368
<methods>public void <init>(java.lang.ClassLoader) ,public java.lang.ClassLoader getServiceClassLoader() ,public java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation) throws java.lang.Throwable<variables>protected java.lang.ClassLoader serviceClassLoader
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/ark-sofa-boot/src/main/java/com/alipay/sofa/boot/ark/invoke/JvmServiceTargetHabitat.java
JvmServiceTargetHabitat
getDefaultServiceComponent
class JvmServiceTargetHabitat { private final String bizName; /** * Key as version * Value as target bean */ private final Map<String, ServiceComponent> habitat = new ConcurrentHashMap<>(); public JvmServiceTargetHabitat(String bizName) { this.bizName = b...
for (String bizVersion : habitat.keySet()) { if (ArkClient.getBizManagerService().isActiveBiz(bizName, bizVersion)) { return habitat.get(bizVersion); } } return null;
206
68
274
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/isle-sofa-boot/src/main/java/com/alipay/sofa/boot/isle/ApplicationRuntimeModel.java
ApplicationRuntimeModel
getResolvedDeployments
class ApplicationRuntimeModel implements IsleDeploymentModel { public static final String APPLICATION_RUNTIME_MODEL_NAME = "APPLICATION_RUNTIME_MODEL"; @Deprecated public static final String APPLICATION = "SOFABOOT-APPLICATION"; /** deploys ...
if (resolvedDeployments != null) { return resolvedDeployments; } //remove all required when no spring powered module exist deploymentMap.values().forEach(dd -> { List<String> requiredModules = dd.getRequiredModules(); if (requiredModules != null) { ...
1,052
163
1,215
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/isle-sofa-boot/src/main/java/com/alipay/sofa/boot/isle/deployment/AbstractDeploymentDescriptor.java
AbstractDeploymentDescriptor
getFormattedModuleInfo
class AbstractDeploymentDescriptor implements DeploymentDescriptor { protected final Properties properties; protected final DeploymentDescriptorConfiguration deploymentDescriptorConfiguration; protected final ClassLoader classLoader; protected final URL ...
String ret = properties.getProperty(key); if (StringUtils.hasText(ret)) { String[] array = StringUtils.commaDelimitedListToStringArray(ret); List<String> list = new ArrayList<>(array.length); for (String item : array) { int idx = item.indexOf(';'); ...
1,525
137
1,662
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/isle-sofa-boot/src/main/java/com/alipay/sofa/boot/isle/deployment/DeployRegistry.java
DeployRegistry
commitDeployments
class DeployRegistry extends DependencyTree<String, DeploymentDescriptor> { // this is needed to handle requiredBy dependencies private final Map<String, DeploymentDescriptor> deployments = Collections .synchronizedSortedMap(new TreeMap<String,...
for (DeploymentDescriptor fd : deployments.values()) { add(fd.getModuleName(), fd, fd.getRequiredModules()); } deployments.clear();
595
50
645
<methods>public void <init>() ,public transient void add(java.lang.String, com.alipay.sofa.boot.isle.deployment.DeploymentDescriptor, java.lang.String[]) ,public void add(java.lang.String, com.alipay.sofa.boot.isle.deployment.DeploymentDescriptor, Collection<java.lang.String>) ,public void add(java.lang.String, com.ali...
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/isle-sofa-boot/src/main/java/com/alipay/sofa/boot/isle/deployment/DeploymentDescriptorFactory.java
DeploymentDescriptorFactory
build
class DeploymentDescriptorFactory { /** * Build a SOFABoot Module deployment descriptor. * * @param url SOFABoot module file url * @param props properties * @param deploymentDescriptorConfiguration deployment descriptor configuration * @param modulePropertyName moduleProperty file ...
if (ResourceUtils.isJarURL(url)) { return createJarDeploymentDescriptor(url, props, deploymentDescriptorConfiguration, classLoader); } else { return createFileDeploymentDescriptor(url, props, deploymentDescriptorConfiguration, classLoader, moduleP...
276
75
351
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/isle-sofa-boot/src/main/java/com/alipay/sofa/boot/isle/deployment/FileDeploymentDescriptor.java
FileDeploymentDescriptor
listFiles
class FileDeploymentDescriptor extends AbstractDeploymentDescriptor { private final String modulePropertyName; public FileDeploymentDescriptor(URL url, Properties props, DeploymentDescriptorConfiguration deploymentDescriptorConfiguration,...
File[] files = parent.listFiles(); if (files == null || files.length == 0) { return; } for (File f : files) { if (f.isFile() && f.getName().endsWith(suffix)) { subFiles.add(f); } else if (f.isDirectory()) { listFiles(su...
372
106
478
<methods>public void <init>(java.net.URL, java.util.Properties, com.alipay.sofa.boot.isle.deployment.DeploymentDescriptorConfiguration, java.lang.ClassLoader) ,public void addInstalledSpringXml(java.lang.String) ,public int compareTo(com.alipay.sofa.boot.isle.deployment.DeploymentDescriptor) ,public void deployFinish()...
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/isle-sofa-boot/src/main/java/com/alipay/sofa/boot/isle/deployment/JarDeploymentDescriptor.java
JarDeploymentDescriptor
loadSpringXMLs
class JarDeploymentDescriptor extends AbstractDeploymentDescriptor { public JarDeploymentDescriptor(URL url, Properties props, DeploymentDescriptorConfiguration deploymentDescriptorConfiguration, ClassLoader cl...
JarFile jarFile; try { URLConnection con = url.openConnection(); Assert.isInstanceOf(JarURLConnection.class, con); JarURLConnection jarCon = (JarURLConnection) con; ResourceUtils.useCachesIfNecessary(jarCon); jarFile = jarCon.getJarFile(); ...
249
263
512
<methods>public void <init>(java.net.URL, java.util.Properties, com.alipay.sofa.boot.isle.deployment.DeploymentDescriptorConfiguration, java.lang.ClassLoader) ,public void addInstalledSpringXml(java.lang.String) ,public int compareTo(com.alipay.sofa.boot.isle.deployment.DeploymentDescriptor) ,public void deployFinish()...
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/isle-sofa-boot/src/main/java/com/alipay/sofa/boot/isle/loader/DynamicSpringContextLoader.java
DynamicSpringContextLoader
loadBeanDefinitions
class DynamicSpringContextLoader implements SpringContextLoader, InitializingBean, StartupReporterAware { private static final Logger LOGGER = SofaBootLoggerFactory ...
if (deployment.getSpringResources() != null) { for (Map.Entry<String, Resource> entry : deployment.getSpringResources().entrySet()) { String fileName = entry.getKey(); beanDefinitionReader.loadBeanDefinitions(entry.getValue()); deployment.addInstalled...
1,721
92
1,813
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/isle-sofa-boot/src/main/java/com/alipay/sofa/boot/isle/profile/DefaultSofaModuleProfileChecker.java
DefaultSofaModuleProfileChecker
acceptProfiles
class DefaultSofaModuleProfileChecker implements SofaModuleProfileChecker, InitializingBean { private final Set<String> activeProfiles = new HashSet<>(); private List<String> userCustomProfiles; @Override public void afterPropertiesSet() { init(); } public void init() { ...
Assert.notEmpty(sofaModuleProfiles, ErrorCode.convert("01-13000", DeploymentDescriptorConfiguration.DEFAULT_PROFILE_VALUE)); for (String sofaModuleProfile : sofaModuleProfiles) { if (StringUtils.hasText(sofaModuleProfile) && sofaModuleProfile.charAt(0) == '!') { ...
571
148
719
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/isle-sofa-boot/src/main/java/com/alipay/sofa/boot/isle/spring/SofaModuleContextLifecycle.java
SofaModuleContextLifecycle
start
class SofaModuleContextLifecycle implements SmartLifecycle { private static final Logger LOGGER = SofaBootLoggerFactory .getLogger(SofaModuleContextLifecycle.class); private final AtomicBoolean isleRefreshed = new AtomicBoolean(false); privat...
if (isleRefreshed.compareAndSet(false, true)) { try { pipelineContext.process(); } catch (Throwable t) { LOGGER.error(ErrorCode.convert("01-10000"), t); throw new RuntimeException(ErrorCode.convert("01-10000"), t); } } ...
217
95
312
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/isle-sofa-boot/src/main/java/com/alipay/sofa/boot/isle/stage/AbstractPipelineStage.java
AbstractPipelineStage
setApplicationContext
class AbstractPipelineStage implements PipelineStage, ApplicationContextAware, BeanFactoryAware, StartupReporterAware, InitializingBean { protected final ClassLoader appClassLoader = Thread.currentThread() ...
Assert.isTrue(applicationContext instanceof ConfigurableApplicationContext, "applicationContext must implement ConfigurableApplicationContext"); this.applicationContext = (ConfigurableApplicationContext) applicationContext;
551
46
597
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/isle-sofa-boot/src/main/java/com/alipay/sofa/boot/isle/stage/DefaultPipelineContext.java
DefaultPipelineContext
appendStages
class DefaultPipelineContext implements PipelineContext { private final List<PipelineStage> stageList = new ArrayList<>(); @Override public void process() throws Exception { stageList.sort(AnnotationAwareOrderComparator.INSTANCE); for (PipelineStage pipelineStage : stageList) { ...
for (PipelineStage pipelineStage : stages) { appendStage(pipelineStage); } return this;
198
37
235
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/isle-sofa-boot/src/main/java/com/alipay/sofa/boot/isle/stage/ModuleLogOutputStage.java
ModuleLogOutputStage
logInstalledModules
class ModuleLogOutputStage extends AbstractPipelineStage { private static final Logger LOGGER = SofaBootLoggerFactory .getLogger(ModuleLogOutputStage.class); public static final String MODULE_LOG_OUTPUT_STAGE_NAME = "Modul...
List<DeploymentDescriptor> deploys = application.getInstalled(); StringBuilder stringBuilder = new StringBuilder(); long totalTime = 0; long realStart = 0; long realEnd = 0; stringBuilder.append("\n").append("Spring context initialize success module list") .a...
503
542
1,045
<methods>public non-sealed void <init>() ,public void afterPropertiesSet() throws java.lang.Exception,public com.alipay.sofa.boot.isle.ApplicationRuntimeModel getApplicationRuntimeModel() ,public void process() throws java.lang.Exception,public void setApplicationContext(org.springframework.context.ApplicationContext) ...
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/rpc-sofa-boot/src/main/java/com/alipay/sofa/rpc/boot/common/NetworkAddressUtil.java
IpRange
parseEnd
class IpRange { private long start; private long end; public IpRange(String ip) { start = parseStart(ip); end = parseEnd(ip); } public IpRange(String startIp, String endIp) { start = parseStart(startIp); end = parseEnd(endIp); ...
int[] ends = { 255, 255, 255, 255 }; return parse(ends, ip);
367
39
406
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/rpc-sofa-boot/src/main/java/com/alipay/sofa/rpc/boot/common/RegistryParseUtil.java
RegistryParseUtil
parseParam
class RegistryParseUtil { /** * Parse address string. * * @param config the config * @param protocol the protocol * @return the string */ public static String parseAddress(String config, String protocol) { String address = null; if (StringUtils.isNotEmpty(config...
String host = parseAddress(address, protocol); //for config ? String paramString = address.substring(address.indexOf(host) + host.length()); if (StringUtils.isNotEmpty(paramString) && paramString.startsWith("?")) { paramString = paramString.substring(1); } ...
415
216
631
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/rpc-sofa-boot/src/main/java/com/alipay/sofa/rpc/boot/common/RpcThreadPoolMonitor.java
RpcThreadPoolMonitor
start
class RpcThreadPoolMonitor { private static final long DEFAULT_SLEEP_TIME = 30000; private final Logger logger; private long sleepTimeMS; /** * 线程池 */ private ThreadPoolExecutor threadPoolExecutor; /** * 开启标志 */ private AtomicInteger startTi...
synchronized (this) { if (threadPoolExecutor != null) { if (startTimes.intValue() == 0) { if (startTimes.incrementAndGet() == 1) { StringBuilder sb = new StringBuilder(); sb.append("coreSize:" + threadPoolExecutor.g...
517
593
1,110
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/rpc-sofa-boot/src/main/java/com/alipay/sofa/rpc/boot/common/SofaBootRpcSpringUtil.java
SofaBootRpcSpringUtil
newInstance
class SofaBootRpcSpringUtil { private static final Logger LOGGER = SofaBootRpcLoggerFactory .getLogger(SofaBootRpcSpringUtil.class); /** * 根据配置的ref以及class字符串,获得真正的spring bean * 先优先获得refBean,再获得class * * @param beanRef spring ref * ...
if (!StringUtils.hasText(clazz)) { return null; } try { return Class.forName(clazz, true, loader).newInstance(); } catch (Exception e) { LOGGER.error("new instance failed. clazz[" + clazz + "];classLoader[" + loader + "];appNa...
560
144
704
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/rpc-sofa-boot/src/main/java/com/alipay/sofa/rpc/boot/config/ConsulConfigurator.java
ConsulConfigurator
parseParam
class ConsulConfigurator implements RegistryConfigureProcessor { public ConsulConfigurator() { } /** * 解析配置 value * * @param config 配置 value */ public String parseAddress(String config) { String address = null; if (StringUtils.isNotEmpty(config) && conf...
String host = parseAddress(address); //for config ? String paramString = address.substring(address.indexOf(host) + host.length()); if (StringUtils.isNotEmpty(paramString) && paramString.startsWith("?")) { paramString = paramString.substring(1); } Map<Stri...
544
214
758
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/rpc-sofa-boot/src/main/java/com/alipay/sofa/rpc/boot/config/FaultToleranceConfigurator.java
FaultToleranceConfigurator
startFaultTolerance
class FaultToleranceConfigurator { private String appName; private String regulationEffectiveStr; private String degradeEffectiveStr; private String timeWindowStr; private String leastWindowCountStr; private String leastWindowExceptionRateMultipleStr; private String weightDegradeRateS...
Boolean regulationEffective = SofaBootRpcParserUtil.parseBoolean(regulationEffectiveStr); Boolean degradeEffective = SofaBootRpcParserUtil.parseBoolean(degradeEffectiveStr); Long timeWindow = SofaBootRpcParserUtil.parseLong(timeWindowStr); Long leastWindowCount = SofaBootRpcParserUtil.p...
564
622
1,186
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/rpc-sofa-boot/src/main/java/com/alipay/sofa/rpc/boot/config/KubernetesConfigurator.java
KubernetesConfigurator
buildFromAddress
class KubernetesConfigurator implements RegistryConfigureProcessor { public KubernetesConfigurator() { } @Override public RegistryConfig buildFromAddress(String address) {<FILL_FUNCTION_BODY>} @Override public String registryType() { return SofaBootRpcConfigConstants.REGISTRY_PROTOCOL...
String kubernetesAddress = RegistryParseUtil.parseAddress(address, SofaBootRpcConfigConstants.REGISTRY_PROTOCOL_KUBERNETES); Map<String, String> map = RegistryParseUtil.parseParam(address, SofaBootRpcConfigConstants.REGISTRY_PROTOCOL_KUBERNETES); return new RegistryConf...
107
145
252
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/rpc-sofa-boot/src/main/java/com/alipay/sofa/rpc/boot/config/LocalFileConfigurator.java
LocalFileConfigurator
buildFromAddress
class LocalFileConfigurator implements RegistryConfigureProcessor { private static String COLON = "://"; public LocalFileConfigurator() { } /** * 读取配置 key ,获取其 value 进行解析。 */ public String parseConfig(String config) { String file = null; if (StringUtils.isNotEmpty(config...
String filePath = parseConfig(address); if (StringUtils.isEmpty(filePath)) { filePath = SofaBootRpcConfigConstants.REGISTRY_FILE_PATH_DEFAULT; } return new RegistryConfig().setFile(filePath).setProtocol( SofaBootRpcConfigConstants.REGISTRY_PROTOCOL_LOCAL);
283
97
380
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/rpc-sofa-boot/src/main/java/com/alipay/sofa/rpc/boot/config/MeshConfigurator.java
MeshConfigurator
buildFromAddress
class MeshConfigurator implements RegistryConfigureProcessor { public static final String HTTP = "http://"; public MeshConfigurator() { } @Override public RegistryConfig buildFromAddress(String address) {<FILL_FUNCTION_BODY>} @Override public String registryType() { return SofaBo...
String meshAddress = RegistryParseUtil.parseAddress(address, SofaBootRpcConfigConstants.REGISTRY_PROTOCOL_MESH); meshAddress = HTTP + meshAddress; return new RegistryConfig().setAddress(meshAddress).setProtocol( SofaBootRpcConfigConstants.REGISTRY_PROTOCOL_MESH);
116
96
212
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/rpc-sofa-boot/src/main/java/com/alipay/sofa/rpc/boot/config/MulticastConfigurator.java
MulticastConfigurator
buildFromAddress
class MulticastConfigurator implements RegistryConfigureProcessor { public MulticastConfigurator() { } @Override public RegistryConfig buildFromAddress(String address) {<FILL_FUNCTION_BODY>} @Override public String registryType() { return SofaBootRpcConfigConstants.REGISTRY_PROTOCOL_M...
String multicastAddress = RegistryParseUtil.parseAddress(address, SofaBootRpcConfigConstants.REGISTRY_PROTOCOL_MULTICAST); Map<String, String> map = RegistryParseUtil.parseParam(address, SofaBootRpcConfigConstants.REGISTRY_PROTOCOL_MULTICAST); return new RegistryConfig(...
106
142
248
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/rpc-sofa-boot/src/main/java/com/alipay/sofa/rpc/boot/config/NacosConfigurator.java
NacosConfigurator
buildFromAddress
class NacosConfigurator implements RegistryConfigureProcessor { public NacosConfigurator() { } @Override public RegistryConfig buildFromAddress(String address) {<FILL_FUNCTION_BODY>} @Override public String registryType() { return SofaBootRpcConfigConstants.REGISTRY_PROTOCOL_NACOS; ...
String nacosAddress = RegistryParseUtil.parseAddress(address, SofaBootRpcConfigConstants.REGISTRY_PROTOCOL_NACOS); Map<String, String> map = RegistryParseUtil.parseParam(address, SofaBootRpcConfigConstants.REGISTRY_PROTOCOL_NACOS); return new RegistryConfig().setAddress...
104
139
243
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/rpc-sofa-boot/src/main/java/com/alipay/sofa/rpc/boot/config/PolarisRegistryConfigurator.java
PolarisRegistryConfigurator
buildFromAddress
class PolarisRegistryConfigurator implements RegistryConfigureProcessor { public PolarisRegistryConfigurator() { } @Override public RegistryConfig buildFromAddress(String address) {<FILL_FUNCTION_BODY>} @Override public String registryType() { return SofaBootRpcConfigConstants.REGISTR...
String polarisAddress = RegistryParseUtil.parseAddress(address, SofaBootRpcConfigConstants.REGISTRY_PROTOCOL_POLARIS); Map<String, String> map = RegistryParseUtil.parseParam(address, SofaBootRpcConfigConstants.REGISTRY_PROTOCOL_POLARIS); return new RegistryConfig().setA...
105
140
245
<no_super_class>
sofastack_sofa-boot
sofa-boot/sofa-boot-project/sofa-boot-core/rpc-sofa-boot/src/main/java/com/alipay/sofa/rpc/boot/config/SofaRegistryConfigurator.java
SofaRegistryConfigurator
buildFromAddress
class SofaRegistryConfigurator implements RegistryConfigureProcessor { public SofaRegistryConfigurator() { } @Override public RegistryConfig buildFromAddress(String address) {<FILL_FUNCTION_BODY>} @Override public String registryType() { return SofaBootRpcConfigConstants.REGISTRY_PROT...
String sofaRegistryAddress = RegistryParseUtil.parseAddress(address, SofaBootRpcConfigConstants.REGISTRY_PROTOCOL_SOFA); Map<String, String> map = RegistryParseUtil.parseParam(address, SofaBootRpcConfigConstants.REGISTRY_PROTOCOL_SOFA); return new RegistryConfig().setAd...
105
135
240
<no_super_class>