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
bucket4j_bucket4j
bucket4j/bucket4j-core/src/main/java/io/github/bucket4j/distributed/serialization/DataOutputSerializationAdapter.java
DataOutputSerializationAdapter
readLongArray
class DataOutputSerializationAdapter implements SerializationAdapter<DataOutput>, DeserializationAdapter<DataInput> { public static DataOutputSerializationAdapter INSTANCE = new DataOutputSerializationAdapter(); private DataOutputSerializationAdapter() {} @Override public boolean readBoolean(DataInpu...
int size = source.readInt(); long array[] = new long[size]; for (int i = 0; i < size; i++) { array[i] = source.readLong(); } return array;
637
61
698
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-core/src/main/java/io/github/bucket4j/distributed/serialization/InternalSerializationHelper.java
InternalSerializationHelper
deserializeRequest
class InternalSerializationHelper { public static byte[] serializeState(RemoteBucketState state, Version backwardCompatibilityVersion) { try { ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); DataOutputStream output = new DataOutputStream(byteStream); Rem...
try { try (DataInputStream inputSteam = new DataInputStream(new ByteArrayInputStream(bytes))) { return (Request<T>) Request.SERIALIZATION_HANDLE.deserialize(DataOutputSerializationAdapter.INSTANCE, inputSteam); } } catch (Exception e) { throw new Ille...
717
91
808
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-core/src/main/java/io/github/bucket4j/distributed/serialization/PrimitiveSerializationHandles.java
PrimitiveSerializationHandles
toJsonCompatibleSnapshot
class PrimitiveSerializationHandles { public static SerializationHandle<Nothing> NULL_HANDLE = new SerializationHandle<Nothing>() { @Override public <I> Nothing deserialize(DeserializationAdapter<I> adapter, I input) throws IOException { return null; } @Override ...
Map<String, Object> result = new HashMap<>(); result.put("value", serializableObject); return result;
941
35
976
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-core/src/main/java/io/github/bucket4j/distributed/serialization/SerializationHandles.java
SerializationHandles
getHandleByTypeId
class SerializationHandles { public static final SerializationHandles CORE_HANDLES = new SerializationHandles(Arrays.asList( Bandwidth.SERIALIZATION_HANDLE, // 1 BucketConfiguration.SERIALIZATION_HANDLE, // 2 BucketState64BitsInteger.SERIALIZATION_HANDLE, // 3 // Buck...
if (typeId > 0) { if (typeId >= handlesById.length) { throw new UnsupportedTypeException(typeId); } SerializationHandle<T> serializationHandle = handlesById[typeId]; if (serializationHandle == null) { throw new UnsupportedTypeExcep...
1,851
166
2,017
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-core/src/main/java/io/github/bucket4j/distributed/versioning/UsageOfObsoleteApiException.java
UsageOfObsoleteApiException
formatMessage
class UsageOfObsoleteApiException extends BackwardCompatibilityException { private final int requestedFormatNumber; private final int minSupportedFormatNumber; public UsageOfObsoleteApiException(int requestedFormatNumber, int minSupportedFormatNumber) { super(formatMessage(requestedFormatNumber, m...
String fmt = "Command cannot be executed, because it encoded in {0} format number, when minimum supported by backend is {1}"; return MessageFormat.format(fmt, formatNumber, minFormatNumber);
195
52
247
<methods>public void <init>(java.lang.String) <variables>
bucket4j_bucket4j
bucket4j/bucket4j-core/src/main/java/io/github/bucket4j/distributed/versioning/UsageOfUnsupportedApiException.java
UsageOfUnsupportedApiException
formatMessage
class UsageOfUnsupportedApiException extends BackwardCompatibilityException { private final int requestedFormatNumber; private final int maxSupportedFormatNumber; public UsageOfUnsupportedApiException(int requestedFormatNumber, int maxSupportedFormatNumber) { super(formatMessage(requestedFormatNum...
String fmt = "Command cannot be executed, because it encoded in {0} format number, when maximum supported by backend is {1}"; return MessageFormat.format(fmt, formatNumber, maxFormatNumber);
193
52
245
<methods>public void <init>(java.lang.String) <variables>
bucket4j_bucket4j
bucket4j/bucket4j-core/src/main/java/io/github/bucket4j/local/LocalBucketBuilder.java
LocalBucketBuilder
withCustomTimePrecision
class LocalBucketBuilder { private final ConfigurationBuilder configurationBuilder; public LocalBucketBuilder() { configurationBuilder = new ConfigurationBuilder(); } /** * Adds limited bandwidth for all buckets which will be constructed by this builder. * * @param bandwidth li...
if (customTimeMeter == null) { throw BucketExceptions.nullTimeMeter(); } this.timeMeter = customTimeMeter; return this;
1,099
49
1,148
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-core/src/main/java/io/github/bucket4j/local/LocalBucketSerializationHelper.java
LocalBucketSerializationHelper
fromBinarySnapshot
class LocalBucketSerializationHelper { private static final DataOutputSerializationAdapter adapter = DataOutputSerializationAdapter.INSTANCE; static byte[] toBinarySnapshot(LocalBucket localBucket) throws IOException { SerializationHandle<LocalBucket> serializationHandle = getSerializationHandle(local...
ByteArrayInputStream bais = new ByteArrayInputStream(snapshot); DataInputStream input = new DataInputStream(bais); int typeId = adapter.readInt(input); SerializationHandle<LocalBucket> serializationHandle = getSerializationHandle(typeId); return serializationHandle.deserialize(a...
965
83
1,048
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-core/src/main/java/io/github/bucket4j/util/concurrent/batch/AsyncBatchHelper.java
AsyncBatchHelper
lockExclusivelyOrEnqueue
class AsyncBatchHelper<T, R, CT, CR> { private static final WaitingTask<?, ?> QUEUE_EMPTY_BUT_EXECUTION_IN_PROGRESS = new WaitingTask<>(null); private static final WaitingTask<?, ?> QUEUE_EMPTY = new WaitingTask<>(null); private final Function<List<T>, CT> taskCombiner; private final Function<CT, Comp...
WaitingTask<T, R> waitingTask = new WaitingTask<>(command); while (true) { WaitingTask<T, R> previous = headReference.get(); if (previous == QUEUE_EMPTY) { if (headReference.compareAndSet(previous, QUEUE_EMPTY_BUT_EXECUTION_IN_PROGRESS)) { re...
1,870
173
2,043
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-hazelcast-all/bucket4j-hazelcast-4/src/main/java/io/github/bucket4j/grid/hazelcast/HazelcastCompareAndSwapBasedProxyManager.java
HazelcastCompareAndSwapBasedProxyManager
beginCompareAndSwapOperation
class HazelcastCompareAndSwapBasedProxyManager<K> extends AbstractCompareAndSwapBasedProxyManager<K> { private final IMap<K, byte[]> map; public HazelcastCompareAndSwapBasedProxyManager(IMap<K, byte[]> map) { this(map, ClientSideConfig.getDefault()); } public HazelcastCompareAndSwapBasedProxy...
return new CompareAndSwapOperation() { @Override public Optional<byte[]> getStateData(Optional<Long> timeoutNanos) { byte[] data = map.get(key); return Optional.ofNullable(data); } @Override public boolean compareAndSw...
325
163
488
<methods>public CommandResult<T> execute(K, Request<T>) ,public CompletableFuture<CommandResult<T>> executeAsync(K, Request<T>) <variables>private static final CommandResult<?> UNSUCCESSFUL_CAS_RESULT
bucket4j_bucket4j
bucket4j/bucket4j-hazelcast-all/bucket4j-hazelcast-4/src/main/java/io/github/bucket4j/grid/hazelcast/HazelcastEntryProcessor.java
HazelcastEntryProcessor
process
class HazelcastEntryProcessor<K, T> implements EntryProcessor<K, byte[], byte[]>, ComparableByContent<HazelcastEntryProcessor> { private static final long serialVersionUID = 1L; private final byte[] requestBytes; private EntryProcessor<K, byte[], byte[]> backupProcessor; public HazelcastEntryProcesso...
return new AbstractBinaryTransaction(requestBytes) { @Override public boolean exists() { return entry.getValue() != null; } @Override protected byte[] getRawState() { return entry.getValue(); } ...
275
278
553
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-hazelcast-all/bucket4j-hazelcast-4/src/main/java/io/github/bucket4j/grid/hazelcast/HazelcastLockBasedProxyManager.java
HazelcastLockBasedProxyManager
allocateTransaction
class HazelcastLockBasedProxyManager<K> extends AbstractLockBasedProxyManager<K> { private final IMap<K, byte[]> map; public HazelcastLockBasedProxyManager(IMap<K, byte[]> map) { this(map, ClientSideConfig.getDefault()); } public HazelcastLockBasedProxyManager(IMap<K, byte[]> map, ClientSideC...
return new LockBasedTransaction() { @Override public void begin(Optional<Long> requestTimeout) { // do nothing } @Override public void rollback() { // do nothing } @Override public...
268
462
730
<methods>public CommandResult<T> execute(K, Request<T>) ,public CompletableFuture<CommandResult<T>> executeAsync(K, Request<T>) ,public boolean isAsyncModeSupported() <variables>
bucket4j_bucket4j
bucket4j/bucket4j-hazelcast-all/bucket4j-hazelcast-4/src/main/java/io/github/bucket4j/grid/hazelcast/HazelcastProxyManager.java
HazelcastProxyManager
addCustomSerializers
class HazelcastProxyManager<K> extends AbstractProxyManager<K> { private final IMap<K, byte[]> map; private final String offloadableExecutorName; public HazelcastProxyManager(IMap<K, byte[]> map) { this(map, ClientSideConfig.getDefault()); } public HazelcastProxyManager(IMap<K, byte[]> ma...
serializationConfig.addSerializerConfig( new SerializerConfig() .setImplementation(new HazelcastEntryProcessorSerializer(SerializationUtilities.getSerializerTypeId(HazelcastEntryProcessorSerializer.class, typeIdBase))) .setTypeClass(HazelcastEntry...
973
303
1,276
<methods>public AsyncProxyManager<K> asAsync() ,public RemoteBucketBuilder<K> builder() ,public Optional<io.github.bucket4j.BucketConfiguration> getProxyConfiguration(K) <variables>private static final io.github.bucket4j.distributed.proxy.RecoveryStrategy DEFAULT_RECOVERY_STRATEGY,private static final io.github.bucket4...
bucket4j_bucket4j
bucket4j/bucket4j-hazelcast-all/bucket4j-hazelcast-4/src/main/java/io/github/bucket4j/grid/hazelcast/SimpleBackupProcessor.java
SimpleBackupProcessor
process
class SimpleBackupProcessor<K> implements EntryProcessor<K, byte[], byte[]>, ComparableByContent<SimpleBackupProcessor> { private static final long serialVersionUID = 1L; private final byte[] state; public SimpleBackupProcessor(byte[] state) { this.state = state; } public byte[] getState...
entry.setValue(state); return null; // return value from backup processor is ignored, see https://github.com/hazelcast/hazelcast/pull/14995
172
50
222
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-hazelcast-all/bucket4j-hazelcast-4/src/main/java/io/github/bucket4j/grid/hazelcast/VersionedBackupProcessor.java
VersionedBackupProcessor
process
class VersionedBackupProcessor<K> implements EntryProcessor<K, byte[], byte[]>, ComparableByContent<VersionedBackupProcessor> { private static final long serialVersionUID = 1L; private final byte[] state; private final Long ttlMillis; public VersionedBackupProcessor(byte[] state, Long ttlMillis) { ...
if (ttlMillis == null) { entry.setValue(state); } else { ExtendedMapEntry extendedMapEntry = (ExtendedMapEntry) entry; extendedMapEntry.setValue(state, ttlMillis, TimeUnit.MILLISECONDS); } return null; // return value from backup processor is ignored,...
248
113
361
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-hazelcast-all/bucket4j-hazelcast-4/src/main/java/io/github/bucket4j/grid/hazelcast/serialization/HazelcastOffloadableEntryProcessorSerializer.java
HazelcastOffloadableEntryProcessorSerializer
read0
class HazelcastOffloadableEntryProcessorSerializer implements StreamSerializer<HazelcastOffloadableEntryProcessor>, TypedStreamDeserializer<HazelcastOffloadableEntryProcessor> { private final int typeId; public HazelcastOffloadableEntryProcessorSerializer(int typeId) { this.typeId = typeId; } ...
byte[] commandBytes = in.readByteArray(); String executorName = in.readUTF(); return new HazelcastOffloadableEntryProcessor(commandBytes, executorName);
380
48
428
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-hazelcast-all/bucket4j-hazelcast-4/src/main/java/io/github/bucket4j/grid/hazelcast/serialization/SerializationUtilities.java
SerializationUtilities
getSerializerTypeId
class SerializationUtilities { public static final String TYPE_ID_BASE_PROP_NAME = "bucket4j.hazelcast.serializer.type_id_base"; private static final Map<Class<? extends Serializer>, Integer> serializerTypeIdOffsets = Map.ofEntries( new AbstractMap.SimpleEntry<Class<? extends Serializer>, Integer>(H...
var typeIdBase = getSerializersTypeIdBase(); if (typeIdBase.isEmpty()) { String msg = MessageFormat.format("Missing TypeIdBase number, impossible to load Bucket4j custom serializers. It must be provided in form of Environment Variable or System Property, both using the following key: [{0}]...
871
125
996
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-hazelcast-all/bucket4j-hazelcast-4/src/main/java/io/github/bucket4j/grid/hazelcast/serialization/VersionedBackupProcessorSerializer.java
VersionedBackupProcessorSerializer
read0
class VersionedBackupProcessorSerializer implements StreamSerializer<VersionedBackupProcessor>, TypedStreamDeserializer<VersionedBackupProcessor> { private final int typeId; public VersionedBackupProcessorSerializer(int typeId) { this.typeId = typeId; } public VersionedBackupProcessorSerialize...
int version = in.readInt(); Versions.check(version, v_8_10_0, v_8_10_0); byte[] state = in.readByteArray(); Long ttlMillis = in.readBoolean() ? in.readLong() : null; return new VersionedBackupProcessor(state, ttlMillis);
397
90
487
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-hazelcast-all/bucket4j-hazelcast/src/main/java/io/github/bucket4j/grid/hazelcast/HazelcastCompareAndSwapBasedProxyManager.java
HazelcastCompareAndSwapBasedProxyManager
beginCompareAndSwapOperation
class HazelcastCompareAndSwapBasedProxyManager<K> extends AbstractCompareAndSwapBasedProxyManager<K> { private final IMap<K, byte[]> map; public HazelcastCompareAndSwapBasedProxyManager(IMap<K, byte[]> map) { this(map, ClientSideConfig.getDefault()); } public HazelcastCompareAndSwapBasedProxy...
return new CompareAndSwapOperation() { @Override public Optional<byte[]> getStateData(Optional<Long> timeoutNanos) { byte[] data = map.get(key); return Optional.ofNullable(data); } @Override public boolean compareAndSw...
325
163
488
<methods>public CommandResult<T> execute(K, Request<T>) ,public CompletableFuture<CommandResult<T>> executeAsync(K, Request<T>) <variables>private static final CommandResult<?> UNSUCCESSFUL_CAS_RESULT
bucket4j_bucket4j
bucket4j/bucket4j-hazelcast-all/bucket4j-hazelcast/src/main/java/io/github/bucket4j/grid/hazelcast/HazelcastEntryProcessor.java
HazelcastEntryProcessor
setRawState
class HazelcastEntryProcessor<K, T> implements EntryProcessor<K, byte[], byte[]>, ComparableByContent<HazelcastEntryProcessor> { private static final long serialVersionUID = 1L; private final byte[] requestBytes; private EntryProcessor<K, byte[], byte[]> backupProcessor; public HazelcastEntryProcesso...
ExpirationAfterWriteStrategy expirationStrategy = getExpirationStrategy(); long ttlMillis = expirationStrategy == null ? -1 : expirationStrategy.calculateTimeToLiveMillis(newState, getCurrentTimeNanos()); if (ttlMillis > 0) { ExtendedMapEntry<K, byte[...
373
180
553
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-hazelcast-all/bucket4j-hazelcast/src/main/java/io/github/bucket4j/grid/hazelcast/HazelcastLockBasedProxyManager.java
HazelcastLockBasedProxyManager
allocateTransaction
class HazelcastLockBasedProxyManager<K> extends AbstractLockBasedProxyManager<K> { private final IMap<K, byte[]> map; public HazelcastLockBasedProxyManager(IMap<K, byte[]> map) { this(map, ClientSideConfig.getDefault()); } public HazelcastLockBasedProxyManager(IMap<K, byte[]> map, ClientSideC...
return new LockBasedTransaction() { @Override public void begin(Optional<Long> requestTimeout) { // do nothing } @Override public void rollback() { // do nothing } @Override public...
268
462
730
<methods>public CommandResult<T> execute(K, Request<T>) ,public CompletableFuture<CommandResult<T>> executeAsync(K, Request<T>) ,public boolean isAsyncModeSupported() <variables>
bucket4j_bucket4j
bucket4j/bucket4j-hazelcast-all/bucket4j-hazelcast/src/main/java/io/github/bucket4j/grid/hazelcast/HazelcastProxyManager.java
HazelcastProxyManager
removeAsync
class HazelcastProxyManager<K> extends AbstractProxyManager<K> { private final IMap<K, byte[]> map; private final String offloadableExecutorName; public HazelcastProxyManager(IMap<K, byte[]> map) { this(map, ClientSideConfig.getDefault()); } public HazelcastProxyManager(IMap<K, byte[]> ma...
CompletionStage<byte[]> hazelcastFuture = map.removeAsync(key); CompletableFuture<Void> resultFuture = new CompletableFuture<>(); hazelcastFuture.whenComplete((oldState, error) -> { if (error == null) { resultFuture.complete(null); } else { result...
1,169
107
1,276
<methods>public AsyncProxyManager<K> asAsync() ,public RemoteBucketBuilder<K> builder() ,public Optional<io.github.bucket4j.BucketConfiguration> getProxyConfiguration(K) <variables>private static final io.github.bucket4j.distributed.proxy.RecoveryStrategy DEFAULT_RECOVERY_STRATEGY,private static final io.github.bucket4...
bucket4j_bucket4j
bucket4j/bucket4j-hazelcast-all/bucket4j-hazelcast/src/main/java/io/github/bucket4j/grid/hazelcast/SimpleBackupProcessor.java
SimpleBackupProcessor
process
class SimpleBackupProcessor<K> implements EntryProcessor<K, byte[], byte[]>, ComparableByContent<SimpleBackupProcessor> { private static final long serialVersionUID = 1L; private final byte[] state; public SimpleBackupProcessor(byte[] state) { this.state = state; } public byte[] getState...
entry.setValue(state); return null; // return value from backup processor is ignored, see https://github.com/hazelcast/hazelcast/pull/14995
172
50
222
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-hazelcast-all/bucket4j-hazelcast/src/main/java/io/github/bucket4j/grid/hazelcast/VersionedBackupProcessor.java
VersionedBackupProcessor
process
class VersionedBackupProcessor<K> implements EntryProcessor<K, byte[], byte[]>, ComparableByContent<VersionedBackupProcessor> { private static final long serialVersionUID = 1L; private final byte[] state; private final Long ttlMillis; public VersionedBackupProcessor(byte[] state, Long ttlMillis) { ...
if (ttlMillis == null) { entry.setValue(state); } else { ExtendedMapEntry extendedMapEntry = (ExtendedMapEntry) entry; extendedMapEntry.setValue(state, ttlMillis, TimeUnit.MILLISECONDS); } return null; // return value from backup processor is ignored,...
248
113
361
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-hazelcast-all/bucket4j-hazelcast/src/main/java/io/github/bucket4j/grid/hazelcast/serialization/HazelcastOffloadableEntryProcessorSerializer.java
HazelcastOffloadableEntryProcessorSerializer
read0
class HazelcastOffloadableEntryProcessorSerializer implements StreamSerializer<HazelcastOffloadableEntryProcessor>, TypedStreamDeserializer<HazelcastOffloadableEntryProcessor> { private final int typeId; public HazelcastOffloadableEntryProcessorSerializer(int typeId) { this.typeId = typeId; } ...
byte[] commandBytes = in.readByteArray(); String executorName = in.readString(); return new HazelcastOffloadableEntryProcessor(commandBytes, executorName);
380
48
428
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-hazelcast-all/bucket4j-hazelcast/src/main/java/io/github/bucket4j/grid/hazelcast/serialization/SerializationUtilities.java
SerializationUtilities
getPropertyValueFromExternal
class SerializationUtilities { public static final String TYPE_ID_BASE_PROP_NAME = "bucket4j.hazelcast.serializer.type_id_base"; private static final Map<Class<? extends Serializer>, Integer> serializerTypeIdOffsets = Map.ofEntries( new AbstractMap.SimpleEntry<Class<? extends Serializer>, Integer>(H...
Optional<Integer> retVal = Optional.empty(); String typeIdBaseStr = typeIdSupplier.get(); if (!StringUtil.isNullOrEmptyAfterTrim(typeIdBaseStr)) { retVal = parseInteger(typeIdBaseStr); if (retVal.isEmpty()) { String msg = MessageFormat.format("The {0} [{...
854
142
996
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-hazelcast-all/bucket4j-hazelcast/src/main/java/io/github/bucket4j/grid/hazelcast/serialization/VersionedBackupProcessorSerializer.java
VersionedBackupProcessorSerializer
read0
class VersionedBackupProcessorSerializer implements StreamSerializer<VersionedBackupProcessor>, TypedStreamDeserializer<VersionedBackupProcessor> { private final int typeId; public VersionedBackupProcessorSerializer(int typeId) { this.typeId = typeId; } public VersionedBackupProcessorSerialize...
int version = in.readInt(); Versions.check(version, v_8_10_0, v_8_10_0); byte[] state = in.readByteArray(); Long ttlMillis = in.readBoolean() ? in.readLong() : null; return new VersionedBackupProcessor(state, ttlMillis);
397
90
487
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-ignite/src/main/java/io/github/bucket4j/grid/ignite/thick/IgniteProxyManager.java
IgniteProxyManager
removeAsync
class IgniteProxyManager<K> extends AbstractProxyManager<K> { private final IgniteCache<K, byte[]> cache; public IgniteProxyManager(IgniteCache<K, byte[]> cache) { this(cache, ClientSideConfig.getDefault()); } public IgniteProxyManager(IgniteCache<K, byte[]> cache, ClientSideConfig clientSide...
IgniteFuture<Boolean> igniteFuture = cache.removeAsync(key); CompletableFuture<Void> completableFuture = new CompletableFuture<>(); igniteFuture.listen((IgniteInClosure<IgniteFuture<Boolean>>) completedIgniteFuture -> { try { completedIgniteFuture.get(); ...
756
128
884
<methods>public AsyncProxyManager<K> asAsync() ,public RemoteBucketBuilder<K> builder() ,public Optional<io.github.bucket4j.BucketConfiguration> getProxyConfiguration(K) <variables>private static final io.github.bucket4j.distributed.proxy.RecoveryStrategy DEFAULT_RECOVERY_STRATEGY,private static final io.github.bucket4...
bucket4j_bucket4j
bucket4j/bucket4j-ignite/src/main/java/io/github/bucket4j/grid/ignite/thin/ThinClientUtils.java
ThinClientUtils
convertFuture
class ThinClientUtils { public static <T> CompletableFuture<T> convertFuture(IgniteClientFuture<T> igniteFuture) {<FILL_FUNCTION_BODY>} }
CompletableFuture<T> completableFuture = new CompletableFuture<>(); igniteFuture.whenComplete((T result, Throwable error) -> { if (error != null) { completableFuture.completeExceptionally(error); } else { completableFuture.complete(result); ...
51
91
142
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-ignite/src/main/java/io/github/bucket4j/grid/ignite/thin/cas/IgniteThinClientCasBasedProxyManager.java
IgniteThinClientCasBasedProxyManager
beginAsyncCompareAndSwapOperation
class IgniteThinClientCasBasedProxyManager<K> extends AbstractCompareAndSwapBasedProxyManager<K> { private final ClientCache<K, ByteBuffer> cache; public IgniteThinClientCasBasedProxyManager(ClientCache<K, ByteBuffer> cache) { this(cache, ClientSideConfig.getDefault()); } public IgniteThinCli...
return new AsyncCompareAndSwapOperation() { @Override public CompletableFuture<Optional<byte[]>> getStateData(Optional<Long> timeoutNanos) { IgniteClientFuture<ByteBuffer> igniteFuture = cache.getAsync(key); CompletableFuture<ByteBuffer> resultFuture = Th...
558
344
902
<methods>public CommandResult<T> execute(K, Request<T>) ,public CompletableFuture<CommandResult<T>> executeAsync(K, Request<T>) <variables>private static final CommandResult<?> UNSUCCESSFUL_CAS_RESULT
bucket4j_bucket4j
bucket4j/bucket4j-ignite/src/main/java/io/github/bucket4j/grid/ignite/thin/compute/Bucket4jComputeTask.java
Bucket4jComputeTask
map
class Bucket4jComputeTask <K> extends ComputeTaskAdapter<Bucket4jComputeTaskParams<K>, byte[]> { public static final String JOB_NAME = Bucket4jComputeTask.class.getName(); @IgniteInstanceResource private Ignite ignite; @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> ...
Bucket4jComputeJob<K> job = new Bucket4jComputeJob<>(params); ClusterNode primaryNodeForKey = ignite.affinity(params.getCacheName()).mapKeyToNode(params.getKey()); for (ClusterNode clusterNode : subgrid) { if (clusterNode == primaryNodeForKey) { return Collections.s...
178
170
348
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-ignite/src/main/java/io/github/bucket4j/grid/ignite/thin/compute/Bucket4jComputeTaskParams.java
Bucket4jComputeTaskParams
toString
class Bucket4jComputeTaskParams<K> implements Serializable { private final String cacheName; private final K key; private final IgniteEntryProcessor<K> processor; public Bucket4jComputeTaskParams(String cacheName, K key, IgniteEntryProcessor<K> processor) { this.cacheName = cacheName; ...
return "Bucket4jComputeTaskParams{" + "cacheName='" + cacheName + '\'' + ", key=" + key + ", processor=" + processor + '}';
192
54
246
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-ignite/src/main/java/io/github/bucket4j/grid/ignite/thin/compute/IgniteEntryProcessor.java
IgniteEntryProcessor
process
class IgniteEntryProcessor<K> implements Serializable, CacheEntryProcessor<K, byte[], byte[]> { private static final long serialVersionUID = 1; private final byte[] requestBytes; IgniteEntryProcessor(Request<?> request) { this.requestBytes = serializeRequest(request); } @Override pub...
return new AbstractBinaryTransaction(requestBytes) { @Override public boolean exists() { return entry.exists(); } @Override protected byte[] getRawState() { return entry.getValue(); } @Override...
127
108
235
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-ignite/src/main/java/io/github/bucket4j/grid/ignite/thin/compute/IgniteThinClientProxyManager.java
IgniteThinClientProxyManager
executeAsync
class IgniteThinClientProxyManager<K> extends AbstractProxyManager<K> { private final ClientCache<K, byte[]> cache; private final ClientCompute clientCompute; public IgniteThinClientProxyManager(ClientCache<K, byte[]> cache, ClientCompute clientCompute) { this(cache, clientCompute, ClientSideConfi...
IgniteEntryProcessor<K> entryProcessor = new IgniteEntryProcessor<>(request); Bucket4jComputeTaskParams<K> taskParams = new Bucket4jComputeTaskParams<>(cache.getName(), key, entryProcessor); IgniteClientFuture<byte[]> igniteFuture = clientCompute.executeAsync2(Bucket4jComputeTask.JOB_NAME, tas...
513
171
684
<methods>public AsyncProxyManager<K> asAsync() ,public RemoteBucketBuilder<K> builder() ,public Optional<io.github.bucket4j.BucketConfiguration> getProxyConfiguration(K) <variables>private static final io.github.bucket4j.distributed.proxy.RecoveryStrategy DEFAULT_RECOVERY_STRATEGY,private static final io.github.bucket4...
bucket4j_bucket4j
bucket4j/bucket4j-infinispan-all/bucket4j-infinispan/src/main/java/io/github/bucket4j/grid/infinispan/InfinispanProcessor.java
InfinispanProcessor
apply
class InfinispanProcessor<K, R> implements SerializableFunction<EntryView.ReadWriteEntryView<K, byte[]>, byte[]>, ComparableByContent<InfinispanProcessor> { private static final long serialVersionUID = 911L; private final byte[] requestBytes; public InfinispanProcessor(Request<R> request)...
if (requestBytes.length == 0) { // it is the marker to remove bucket state if (entry.find().isPresent()) { entry.remove(); return new byte[0]; } } return new AbstractBinaryTransaction(requestBytes) { @Override ...
251
166
417
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-infinispan-all/bucket4j-infinispan/src/main/java/io/github/bucket4j/grid/infinispan/InfinispanProxyManager.java
InfinispanProxyManager
execute
class InfinispanProxyManager<K> extends AbstractProxyManager<K> { private final InfinispanProcessor<K, Void> REMOVE_BUCKET_ENTRY_PROCESSOR = new InfinispanProcessor<>(new byte[0]); private final ReadWriteMap<K, byte[]> readWriteMap; public InfinispanProxyManager(ReadWriteMap<K, byte[]> readWriteMap) { ...
InfinispanProcessor<K, T> entryProcessor = new InfinispanProcessor<>(request); try { CompletableFuture<byte[]> resultFuture = readWriteMap.eval(key, entryProcessor); return (CommandResult<T>) resultFuture.thenApply(resultBytes -> deserializeResult(resultBytes, request.getBackwar...
601
122
723
<methods>public AsyncProxyManager<K> asAsync() ,public RemoteBucketBuilder<K> builder() ,public Optional<io.github.bucket4j.BucketConfiguration> getProxyConfiguration(K) <variables>private static final io.github.bucket4j.distributed.proxy.RecoveryStrategy DEFAULT_RECOVERY_STRATEGY,private static final io.github.bucket4...
bucket4j_bucket4j
bucket4j/bucket4j-infinispan-all/bucket4j-infinispan/src/main/java/io/github/bucket4j/grid/infinispan/serialization/Bucket4jProtobufContextInitializer.java
Bucket4jProtobufContextInitializer
registerSchema
class Bucket4jProtobufContextInitializer implements SerializationContextInitializer { private static final String FOOTER = "package bucket4j;\n"; private static final String TYPE_TEMPLATE = "message [type_name] {\n" + "\n" + " required bytes data = 1;\n" + "\n" + ...
StringBuilder protoBuilder = new StringBuilder(FOOTER); protoBuilder.append(TYPE_TEMPLATE.replace("[type_name]", "InfinispanProcessor")); String generatedProtoFile = protoBuilder.toString(); FileDescriptorSource protoSource = FileDescriptorSource.fromString(getProtoFileName(), generat...
247
97
344
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-jcache/src/main/java/io/github/bucket4j/grid/jcache/CompatibilityTest.java
CompatibilityTest
test
class CompatibilityTest { final Cache<String, Integer> cache; public CompatibilityTest(Cache<String, Integer> cache) { this.cache = cache; } public void test() throws InterruptedException {<FILL_FUNCTION_BODY>} }
String key = "42"; int threads = 4; int iterations = 1000; cache.put(key, 0); CountDownLatch latch = new CountDownLatch(threads); for (int i = 0; i < threads; i++) { new Thread(() -> { try { for (int j = 0; j < iterations; ...
76
396
472
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-jcache/src/main/java/io/github/bucket4j/grid/jcache/JCacheProxyManager.java
JCacheProxyManager
executeAsync
class JCacheProxyManager<K> extends AbstractProxyManager<K> { private static final Map<String, String> incompatibleProviders = Collections.emptyMap(); static { // incompatibleProviders.put("org.infinispan", " use module bucket4j-infinispan directly"); } private static final Set<String> preferL...
// because JCache does not specify async API throw new UnsupportedOperationException();
1,245
23
1,268
<methods>public AsyncProxyManager<K> asAsync() ,public RemoteBucketBuilder<K> builder() ,public Optional<io.github.bucket4j.BucketConfiguration> getProxyConfiguration(K) <variables>private static final io.github.bucket4j.distributed.proxy.RecoveryStrategy DEFAULT_RECOVERY_STRATEGY,private static final io.github.bucket4...
bucket4j_bucket4j
bucket4j/bucket4j-mariadb/src/main/java/io/github/bucket4j/mariadb/MariaDBSelectForUpdateBasedProxyManager.java
MariaDBSelectForUpdateBasedProxyManager
update
class MariaDBSelectForUpdateBasedProxyManager<K> extends AbstractSelectForUpdateBasedProxyManager<K> { private final DataSource dataSource; private final SQLProxyConfiguration<K> configuration; private final String removeSqlQuery; private final String updateSqlQuery; private final String insertSqlQ...
try { try (PreparedStatement updateStatement = connection.prepareStatement(updateSqlQuery)) { applyTimeout(updateStatement, timeoutNanos); updateStatement.setBytes(1, data); configuration.getPrimaryKeyMapper().s...
1,198
112
1,310
<methods>public CommandResult<T> execute(K, Request<T>) ,public CompletableFuture<CommandResult<T>> executeAsync(K, Request<T>) ,public boolean isAsyncModeSupported() <variables>private static final CommandResult#RAW RETRY_IN_THE_SCOPE_OF_NEW_TRANSACTION
bucket4j_bucket4j
bucket4j/bucket4j-mssql/src/main/java/io/github/bucket4j/mssql/MSSQLSelectForUpdateBasedProxyManager.java
MSSQLSelectForUpdateBasedProxyManager
allocateTransaction
class MSSQLSelectForUpdateBasedProxyManager<K> extends AbstractSelectForUpdateBasedProxyManager<K> { private final DataSource dataSource; private final SQLProxyConfiguration<K> configuration; private final String removeSqlQuery; private final String updateSqlQuery; private final String insertSqlQue...
Connection connection; try { connection = dataSource.getConnection(); } catch (SQLException e) { throw new BucketExceptions.BucketExecutionException(e); } return new SelectForUpdateBasedTransaction() { @Override public void begin(...
520
910
1,430
<methods>public CommandResult<T> execute(K, Request<T>) ,public CompletableFuture<CommandResult<T>> executeAsync(K, Request<T>) ,public boolean isAsyncModeSupported() <variables>private static final CommandResult#RAW RETRY_IN_THE_SCOPE_OF_NEW_TRANSACTION
bucket4j_bucket4j
bucket4j/bucket4j-mysql/src/main/java/io/github/bucket4j/mysql/MySQLSelectForUpdateBasedProxyManager.java
MySQLSelectForUpdateBasedProxyManager
allocateTransaction
class MySQLSelectForUpdateBasedProxyManager<K> extends AbstractSelectForUpdateBasedProxyManager<K> { private final DataSource dataSource; private final SQLProxyConfiguration<K> configuration; private final String removeSqlQuery; private final String updateSqlQuery; private final String insertSqlQue...
Connection connection; try { connection = dataSource.getConnection(); } catch (SQLException e) { throw new BucketExceptions.BucketExecutionException(e); } return new SelectForUpdateBasedTransaction() { @Override public void begin(...
509
809
1,318
<methods>public CommandResult<T> execute(K, Request<T>) ,public CompletableFuture<CommandResult<T>> executeAsync(K, Request<T>) ,public boolean isAsyncModeSupported() <variables>private static final CommandResult#RAW RETRY_IN_THE_SCOPE_OF_NEW_TRANSACTION
bucket4j_bucket4j
bucket4j/bucket4j-oracle/src/main/java/io/github/bucket4j/oracle/OracleSelectForUpdateBasedProxyManager.java
OracleSelectForUpdateBasedProxyManager
allocateTransaction
class OracleSelectForUpdateBasedProxyManager<K> extends AbstractSelectForUpdateBasedProxyManager<K> { private final DataSource dataSource; private final SQLProxyConfiguration<K> configuration; private final String removeSqlQuery; private final String updateSqlQuery; private final String insertSqlQu...
Connection connection; try { connection = dataSource.getConnection(); } catch (SQLException e) { throw new BucketExceptions.BucketExecutionException(e); } return new SelectForUpdateBasedTransaction() { @Override public void begin(...
623
814
1,437
<methods>public CommandResult<T> execute(K, Request<T>) ,public CompletableFuture<CommandResult<T>> executeAsync(K, Request<T>) ,public boolean isAsyncModeSupported() <variables>private static final CommandResult#RAW RETRY_IN_THE_SCOPE_OF_NEW_TRANSACTION
bucket4j_bucket4j
bucket4j/bucket4j-postgresql/src/main/java/io/github/bucket4j/postgresql/PostgreSQLSelectForUpdateBasedProxyManager.java
PostgreSQLSelectForUpdateBasedProxyManager
tryLockAndGet
class PostgreSQLSelectForUpdateBasedProxyManager<K> extends AbstractSelectForUpdateBasedProxyManager<K> { private final DataSource dataSource; private final SQLProxyConfiguration<K> configuration; private final String removeSqlQuery; private final String updateSqlQuery; private final String insertS...
try (PreparedStatement selectStatement = connection.prepareStatement(selectSqlQuery)) { applyTimeout(selectStatement, requestTimeoutNanos); configuration.getPrimaryKeyMapper().set(selectStatement, 1, key); try (ResultSet rs = selectStatement.e...
1,131
165
1,296
<methods>public CommandResult<T> execute(K, Request<T>) ,public CompletableFuture<CommandResult<T>> executeAsync(K, Request<T>) ,public boolean isAsyncModeSupported() <variables>private static final CommandResult#RAW RETRY_IN_THE_SCOPE_OF_NEW_TRANSACTION
bucket4j_bucket4j
bucket4j/bucket4j-postgresql/src/main/java/io/github/bucket4j/postgresql/PostgreSQLadvisoryLockBasedProxyManager.java
PostgreSQLadvisoryLockBasedProxyManager
update
class PostgreSQLadvisoryLockBasedProxyManager<K> extends AbstractLockBasedProxyManager<K> { private final DataSource dataSource; private final SQLProxyConfiguration<K> configuration; private final String removeSqlQuery; private final String updateSqlQuery; private final String insertSqlQuery; p...
try { try (PreparedStatement updateStatement = connection.prepareStatement(updateSqlQuery)) { applyTimeout(updateStatement, requestTimeout); updateStatement.setBytes(1, data); configuration.getPrimaryKeyMapper()...
1,265
110
1,375
<methods>public CommandResult<T> execute(K, Request<T>) ,public CompletableFuture<CommandResult<T>> executeAsync(K, Request<T>) ,public boolean isAsyncModeSupported() <variables>
bucket4j_bucket4j
bucket4j/bucket4j-redis/src/main/java/io/github/bucket4j/redis/AbstractRedisProxyManagerBuilder.java
AbstractRedisProxyManagerBuilder
getNotNullExpirationStrategy
class AbstractRedisProxyManagerBuilder<T extends AbstractRedisProxyManagerBuilder> { private ExpirationAfterWriteStrategy expirationStrategy; private ClientSideConfig clientSideConfig = ClientSideConfig.getDefault(); /** * @deprecated use {@link ClientSideConfig#withExpirationAfterWriteStrategy(Expir...
Optional<ExpirationAfterWriteStrategy> optionalStrategy = clientSideConfig.getExpirationAfterWriteStrategy(); if (optionalStrategy.isPresent()) { return optionalStrategy.get(); } if (expirationStrategy == null) { return ExpirationAfterWriteStrategy.none(); ...
266
81
347
<no_super_class>
bucket4j_bucket4j
bucket4j/bucket4j-redis/src/main/java/io/github/bucket4j/redis/jedis/cas/JedisBasedProxyManager.java
JedisBasedProxyManagerBuilder
compareAndSwap
class JedisBasedProxyManagerBuilder<K> extends AbstractRedisProxyManagerBuilder<JedisBasedProxyManagerBuilder<K>> { private final RedisApi redisApi; private Mapper<K> keyMapper; public <Key> JedisBasedProxyManagerBuilder<Key> withKeyMapper(Mapper<Key> keyMapper) { this.keyMapper = ...
long ttlMillis = calculateTtlMillis(newState); if (ttlMillis > 0) { if (originalData == null) { // nulls are prohibited as values, so "replace" must not be used in such cases byte[][] keysAndArgs = {key, newData, encodeLong(ttlMillis)}; Object...
655
444
1,099
<methods>public CommandResult<T> execute(K, Request<T>) ,public CompletableFuture<CommandResult<T>> executeAsync(K, Request<T>) <variables>private static final CommandResult<?> UNSUCCESSFUL_CAS_RESULT
bucket4j_bucket4j
bucket4j/bucket4j-redis/src/main/java/io/github/bucket4j/redis/lettuce/cas/LettuceBasedProxyManager.java
LettuceBasedProxyManagerBuilder
compareAndSwapFuture
class LettuceBasedProxyManagerBuilder<K> extends AbstractRedisProxyManagerBuilder<LettuceBasedProxyManagerBuilder<K>> { private final RedisApi<K> redisApi; private LettuceBasedProxyManagerBuilder(RedisApi<K> redisApi) { this.redisApi = Objects.requireNonNull(redisApi); } p...
long ttlMillis = calculateTtlMillis(newState); if (ttlMillis > 0) { if (originalData == null) { // nulls are prohibited as values, so "replace" must not be used in such cases byte[][] params = {newData, encodeLong(ttlMillis)}; return redisApi....
828
336
1,164
<methods>public CommandResult<T> execute(K, Request<T>) ,public CompletableFuture<CommandResult<T>> executeAsync(K, Request<T>) <variables>private static final CommandResult<?> UNSUCCESSFUL_CAS_RESULT
bucket4j_bucket4j
bucket4j/bucket4j-redis/src/main/java/io/github/bucket4j/redis/redisson/cas/RedissonBasedProxyManager.java
RedissonBasedProxyManagerBuilder
compareAndSwap
class RedissonBasedProxyManagerBuilder<K> extends AbstractRedisProxyManagerBuilder<RedissonBasedProxyManagerBuilder<K>> { private final CommandAsyncExecutor commandExecutor; private Mapper<K> keyMapper; private RedissonBasedProxyManagerBuilder(Mapper<K> keyMapper, CommandAsyncExecutor commandE...
long ttlMillis = calculateTtlMillis(newState); if (ttlMillis > 0) { if (originalData == null) { // Redisson prohibits the usage null as values, so "replace" must not be used in such cases RFuture<Boolean> redissonFuture...
521
447
968
<methods>public CommandResult<T> execute(K, Request<T>) ,public CompletableFuture<CommandResult<T>> executeAsync(K, Request<T>) <variables>private static final CommandResult<?> UNSUCCESSFUL_CAS_RESULT
sohutv_cachecloud
cachecloud/cachecloud-custom/src/main/java/com/sohu/cache/configuration/DefaultRestTemplateConfig.java
DefaultRestTemplateConfig
restTemplate
class DefaultRestTemplateConfig { private static int connectTimeout = 4000; private static int readTimeout = 5000; @ConditionalOnMissingBean(name = "restTemplate") @Bean RestTemplate restTemplate() {<FILL_FUNCTION_BODY>} }
HttpComponentsClientHttpRequestFactory f = new HttpComponentsClientHttpRequestFactory(); f.setConnectTimeout(connectTimeout); f.setReadTimeout(readTimeout); f.setConnectionRequestTimeout(connectTimeout); RestTemplate restTemplate = new RestTemplate(f); return restTemplat...
75
76
151
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-custom/src/main/java/com/sohu/cache/login/impl/DefaultLoginComponent.java
DefaultLoginComponent
getUrl
class DefaultLoginComponent implements LoginComponent { private Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired private RestTemplate restTemplate; @Value(value = "${server.port:8080}") private String serverPort; private static final String RELATIVE_URL = "/manage/loginCh...
InetAddress address = null; try { address = InetAddress.getLocalHost(); } catch (UnknownHostException e) { logger.error(e.getMessage(), e); } if(address != null){ return "http://" + address.getHostAddress() + ":" + this.serverPort; } ...
607
111
718
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/alert/strategy/AlertConfigStrategy.java
AlertConfigStrategy
isCompareStringRight
class AlertConfigStrategy { protected final static String MB_STRING = "MB"; protected final static String EMPTY = ""; /** * 检查配置 * * @param instanceAlertConfig * @param alertConfigBaseData */ public abstract List<InstanceAlertValueResult> checkConfig(InstanceAlertConfig i...
String alertValue = instanceAlertConfig.getAlertValue(); int compareType = instanceAlertConfig.getCompareType(); if (compareType == InstanceAlertCompareTypeEnum.EQUAL.getValue() && currentValue.equals(alertValue)) { return false; } else if (compareType == InstanceAlertCompar...
1,585
121
1,706
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/alert/strategy/AofCurrentSizeAlertStrategy.java
AofCurrentSizeAlertStrategy
checkConfig
class AofCurrentSizeAlertStrategy extends AlertConfigStrategy { @Override public List<InstanceAlertValueResult> checkConfig(InstanceAlertConfig instanceAlertConfig, AlertConfigBaseData alertConfigBaseData) {<FILL_FUNCTION_BODY>} }
Object object = getValueFromRedisInfo(alertConfigBaseData.getStandardStats(), RedisInfoEnum.aof_current_size.getValue()); // 没有配置Aof if (object == null) { return null; } long aofCurrentSize = NumberUtils.toLong(object.toString()); aofCurrentSize = changeByteT...
69
199
268
<methods>public non-sealed void <init>() ,public abstract List<com.sohu.cache.entity.InstanceAlertValueResult> checkConfig(com.sohu.cache.entity.InstanceAlertConfig, com.sohu.cache.alert.bean.AlertConfigBaseData) <variables>protected static final java.lang.String EMPTY,protected static final java.lang.String MB_STRING
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/alert/strategy/ClientBiggestInputBufAlertStrategy.java
ClientBiggestInputBufAlertStrategy
checkConfig
class ClientBiggestInputBufAlertStrategy extends AlertConfigStrategy { @Override public List<InstanceAlertValueResult> checkConfig(InstanceAlertConfig instanceAlertConfig, AlertConfigBaseData alertConfigBaseData) {<FILL_FUNCTION_BODY>} }
Object object = getValueFromRedisInfo(alertConfigBaseData.getStandardStats(), RedisInfoEnum.client_biggest_input_buf.getValue()); if (object == null) { return null; } // 关系比对 long clientBiggestInputBuf = NumberUtils.toLong(object.toString()) ; clientBiggestIn...
69
206
275
<methods>public non-sealed void <init>() ,public abstract List<com.sohu.cache.entity.InstanceAlertValueResult> checkConfig(com.sohu.cache.entity.InstanceAlertConfig, com.sohu.cache.alert.bean.AlertConfigBaseData) <variables>protected static final java.lang.String EMPTY,protected static final java.lang.String MB_STRING
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/alert/strategy/ClientLongestOutputListAlertStrategy.java
ClientLongestOutputListAlertStrategy
checkConfig
class ClientLongestOutputListAlertStrategy extends AlertConfigStrategy { @Override public List<InstanceAlertValueResult> checkConfig(InstanceAlertConfig instanceAlertConfig, AlertConfigBaseData alertConfigBaseData) {<FILL_FUNCTION_BODY>} }
Object object = getValueFromRedisInfo(alertConfigBaseData.getStandardStats(), RedisInfoEnum.client_longest_output_list.getValue()); if (object == null) { return null; } // 关系比对 long clientLongestOutputList = NumberUtils.toLong(object.toString()); boolean comp...
69
186
255
<methods>public non-sealed void <init>() ,public abstract List<com.sohu.cache.entity.InstanceAlertValueResult> checkConfig(com.sohu.cache.entity.InstanceAlertConfig, com.sohu.cache.alert.bean.AlertConfigBaseData) <variables>protected static final java.lang.String EMPTY,protected static final java.lang.String MB_STRING
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/alert/strategy/ClusterSlotsOkAlertStrategy.java
ClusterSlotsOkAlertStrategy
checkConfig
class ClusterSlotsOkAlertStrategy extends AlertConfigStrategy { @Override public List<InstanceAlertValueResult> checkConfig(InstanceAlertConfig instanceAlertConfig, AlertConfigBaseData alertConfigBaseData) {<FILL_FUNCTION_BODY>} }
Object object = getValueFromClusterInfo(alertConfigBaseData.getStandardStats(), RedisClusterInfoEnum.cluster_slots_ok.getValue()); if (object == null) { return null; } // 关系比对 int clusterSlotsOk = NumberUtils.toInt(object.toString()); boolean compareRight = i...
70
181
251
<methods>public non-sealed void <init>() ,public abstract List<com.sohu.cache.entity.InstanceAlertValueResult> checkConfig(com.sohu.cache.entity.InstanceAlertConfig, com.sohu.cache.alert.bean.AlertConfigBaseData) <variables>protected static final java.lang.String EMPTY,protected static final java.lang.String MB_STRING
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/alert/strategy/ClusterStateAlertStrategy.java
ClusterStateAlertStrategy
checkConfig
class ClusterStateAlertStrategy extends AlertConfigStrategy { @Override public List<InstanceAlertValueResult> checkConfig(InstanceAlertConfig instanceAlertConfig, AlertConfigBaseData alertConfigBaseData) {<FILL_FUNCTION_BODY>} }
Object object = getValueFromClusterInfo(alertConfigBaseData.getStandardStats(), RedisClusterInfoEnum.cluster_state.getValue()); if (object == null) { return null; } // 关系比对 String clusterState = object.toString(); boolean compareRight = isCompareStringRight(i...
68
166
234
<methods>public non-sealed void <init>() ,public abstract List<com.sohu.cache.entity.InstanceAlertValueResult> checkConfig(com.sohu.cache.entity.InstanceAlertConfig, com.sohu.cache.alert.bean.AlertConfigBaseData) <variables>protected static final java.lang.String EMPTY,protected static final java.lang.String MB_STRING
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/alert/strategy/DefaultCommonAlertStrategy.java
DefaultCommonAlertStrategy
checkConfig
class DefaultCommonAlertStrategy extends AlertConfigStrategy { @Override public List<InstanceAlertValueResult> checkConfig(InstanceAlertConfig instanceAlertConfig, AlertConfigBaseData alertConfigBaseData) {<FILL_FUNCTION_BODY>} private boolean judgeNumber(Object object){ Pattern numberPattern = Pa...
Object object = getValueFromRedisInfo(alertConfigBaseData.getStandardStats(), instanceAlertConfig.getAlertConfig()); if (object == null) { return null; } if(judgeNumber(object)){ if(judegNumberIsDouble(object)){ double currentValue= NumberUtils.to...
179
294
473
<methods>public non-sealed void <init>() ,public abstract List<com.sohu.cache.entity.InstanceAlertValueResult> checkConfig(com.sohu.cache.entity.InstanceAlertConfig, com.sohu.cache.alert.bean.AlertConfigBaseData) <variables>protected static final java.lang.String EMPTY,protected static final java.lang.String MB_STRING
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/alert/strategy/InstantaneousOpsPerSecAlertStrategy.java
InstantaneousOpsPerSecAlertStrategy
checkConfig
class InstantaneousOpsPerSecAlertStrategy extends AlertConfigStrategy { @Override public List<InstanceAlertValueResult> checkConfig(InstanceAlertConfig instanceAlertConfig, AlertConfigBaseData alertConfigBaseData) {<FILL_FUNCTION_BODY>} }
Object object = getValueFromRedisInfo(alertConfigBaseData.getStandardStats(), RedisInfoEnum.instantaneous_ops_per_sec.getValue()); if (object == null) { return null; } // 关系比对 long instantaneousOpsPerSec = NumberUtils.toLong(object.toString()); boolean compar...
71
191
262
<methods>public non-sealed void <init>() ,public abstract List<com.sohu.cache.entity.InstanceAlertValueResult> checkConfig(com.sohu.cache.entity.InstanceAlertConfig, com.sohu.cache.alert.bean.AlertConfigBaseData) <variables>protected static final java.lang.String EMPTY,protected static final java.lang.String MB_STRING
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/alert/strategy/MasterSlaveOffsetAlertStrategy.java
MasterSlaveOffsetAlertStrategy
checkConfig
class MasterSlaveOffsetAlertStrategy extends AlertConfigStrategy { /** * 格式: * connected_slaves:2 * slave0:ip=x.x.x.x,port=6380,state=online,offset=33119690469561,lag=1 * slave1:ip=x.x.x.x,port=6380,state=online,offset=33119690513578,lag=0 * master_repl_offset:3311965319442...
Object connectedSlavesObject = getValueFromRedisInfo(alertConfigBaseData.getStandardStats(), RedisInfoEnum.connected_slaves.getValue()); if (connectedSlavesObject == null) { return null; } int connectedSlaves = NumberUtils.toInt(connectedSlavesObject.toString()); if ...
214
622
836
<methods>public non-sealed void <init>() ,public abstract List<com.sohu.cache.entity.InstanceAlertValueResult> checkConfig(com.sohu.cache.entity.InstanceAlertConfig, com.sohu.cache.alert.bean.AlertConfigBaseData) <variables>protected static final java.lang.String EMPTY,protected static final java.lang.String MB_STRING
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/alert/strategy/MemFragmentationRatioAlertStrategy.java
MemFragmentationRatioAlertStrategy
checkConfig
class MemFragmentationRatioAlertStrategy extends AlertConfigStrategy { /** * 实例最小500MB才进行内存碎片率检查,否则价值不是很大 */ private final static long MIN_CHECK_MEMORY = 500L * 1024 * 1024; @Override public List<InstanceAlertValueResult> checkConfig(InstanceAlertConfig instanceAlertConfig, AlertConf...
// 检查内存 Object usedMemoryObject = getValueFromRedisInfo(alertConfigBaseData.getStandardStats(), RedisInfoEnum.used_memory.getValue()); long usedMemory = NumberUtils.toLong(usedMemoryObject.toString()); if (usedMemory < MIN_CHECK_MEMORY) { return null; } ...
134
352
486
<methods>public non-sealed void <init>() ,public abstract List<com.sohu.cache.entity.InstanceAlertValueResult> checkConfig(com.sohu.cache.entity.InstanceAlertConfig, com.sohu.cache.alert.bean.AlertConfigBaseData) <variables>protected static final java.lang.String EMPTY,protected static final java.lang.String MB_STRING
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/alert/strategy/MinuteAofDelayedFsyncAlertStrategy.java
MinuteAofDelayedFsyncAlertStrategy
checkConfig
class MinuteAofDelayedFsyncAlertStrategy extends AlertConfigStrategy { @Override public List<InstanceAlertValueResult> checkConfig(InstanceAlertConfig instanceAlertConfig, AlertConfigBaseData alertConfigBaseData) {<FILL_FUNCTION_BODY>} }
Object object = getValueFromDiffInfo(alertConfigBaseData.getStandardStats(), RedisInfoEnum.aof_delayed_fsync.getValue()); if (object == null) { return null; } long aofDelayedFsync = NumberUtils.toLong(object.toString()); boolean compareRight = isCompareLongRight(inst...
73
181
254
<methods>public non-sealed void <init>() ,public abstract List<com.sohu.cache.entity.InstanceAlertValueResult> checkConfig(com.sohu.cache.entity.InstanceAlertConfig, com.sohu.cache.alert.bean.AlertConfigBaseData) <variables>protected static final java.lang.String EMPTY,protected static final java.lang.String MB_STRING
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/alert/strategy/MinuteRejectedConnectionsAlertStrategy.java
MinuteRejectedConnectionsAlertStrategy
checkConfig
class MinuteRejectedConnectionsAlertStrategy extends AlertConfigStrategy { @Override public List<InstanceAlertValueResult> checkConfig(InstanceAlertConfig instanceAlertConfig, AlertConfigBaseData alertConfigBaseData) {<FILL_FUNCTION_BODY>} }
Object object = getValueFromDiffInfo(alertConfigBaseData.getStandardStats(), RedisInfoEnum.rejected_connections.getValue()); if (object == null) { return null; } long minuteRejectedConnections = NumberUtils.toLong(object.toString()); boolean compareRight = isCompareL...
71
175
246
<methods>public non-sealed void <init>() ,public abstract List<com.sohu.cache.entity.InstanceAlertValueResult> checkConfig(com.sohu.cache.entity.InstanceAlertConfig, com.sohu.cache.alert.bean.AlertConfigBaseData) <variables>protected static final java.lang.String EMPTY,protected static final java.lang.String MB_STRING
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/alert/strategy/MinuteSyncFullAlertStrategy.java
MinuteSyncFullAlertStrategy
checkConfig
class MinuteSyncFullAlertStrategy extends AlertConfigStrategy { @Override public List<InstanceAlertValueResult> checkConfig(InstanceAlertConfig instanceAlertConfig, AlertConfigBaseData alertConfigBaseData) {<FILL_FUNCTION_BODY>} }
Object object = getValueFromDiffInfo(alertConfigBaseData.getStandardStats(), RedisInfoEnum.sync_full.getValue()); if (object == null) { return null; } long minuteSyncFull = NumberUtils.toLong(object.toString()); boolean compareRight = isCompareLongRight(instanceAlert...
69
167
236
<methods>public non-sealed void <init>() ,public abstract List<com.sohu.cache.entity.InstanceAlertValueResult> checkConfig(com.sohu.cache.entity.InstanceAlertConfig, com.sohu.cache.alert.bean.AlertConfigBaseData) <variables>protected static final java.lang.String EMPTY,protected static final java.lang.String MB_STRING
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/alert/strategy/MinuteSyncPartialErrAlertStrategy.java
MinuteSyncPartialErrAlertStrategy
checkConfig
class MinuteSyncPartialErrAlertStrategy extends AlertConfigStrategy { @Override public List<InstanceAlertValueResult> checkConfig(InstanceAlertConfig instanceAlertConfig, AlertConfigBaseData alertConfigBaseData) {<FILL_FUNCTION_BODY>} }
Object object = getValueFromDiffInfo(alertConfigBaseData.getStandardStats(), RedisInfoEnum.sync_partial_err.getValue()); if (object == null) { return null; } long minuteSyncPartialErr = NumberUtils.toLong(object.toString()); boolean compareRight = isCompareLongRight(...
71
175
246
<methods>public non-sealed void <init>() ,public abstract List<com.sohu.cache.entity.InstanceAlertValueResult> checkConfig(com.sohu.cache.entity.InstanceAlertConfig, com.sohu.cache.alert.bean.AlertConfigBaseData) <variables>protected static final java.lang.String EMPTY,protected static final java.lang.String MB_STRING
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/alert/strategy/MinuteSyncPartialOkAlertStrategy.java
MinuteSyncPartialOkAlertStrategy
checkConfig
class MinuteSyncPartialOkAlertStrategy extends AlertConfigStrategy { @Override public List<InstanceAlertValueResult> checkConfig(InstanceAlertConfig instanceAlertConfig, AlertConfigBaseData alertConfigBaseData) {<FILL_FUNCTION_BODY>} }
Object object = getValueFromDiffInfo(alertConfigBaseData.getStandardStats(), RedisInfoEnum.sync_partial_ok.getValue()); if (object == null) { return null; } long minuteSyncPartialOk = NumberUtils.toLong(object.toString()); boolean compareRight = isCompareLongRight(in...
71
175
246
<methods>public non-sealed void <init>() ,public abstract List<com.sohu.cache.entity.InstanceAlertValueResult> checkConfig(com.sohu.cache.entity.InstanceAlertConfig, com.sohu.cache.alert.bean.AlertConfigBaseData) <variables>protected static final java.lang.String EMPTY,protected static final java.lang.String MB_STRING
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/alert/strategy/MinuteTotalNetInputMBytesAlertStrategy.java
MinuteTotalNetInputMBytesAlertStrategy
checkConfig
class MinuteTotalNetInputMBytesAlertStrategy extends AlertConfigStrategy { @Override public List<InstanceAlertValueResult> checkConfig(InstanceAlertConfig instanceAlertConfig, AlertConfigBaseData alertConfigBaseData) {<FILL_FUNCTION_BODY>} }
Object totalNetInputBytesObject = getValueFromDiffInfo(alertConfigBaseData.getStandardStats(), RedisInfoEnum.total_net_input_bytes.getValue()); if (totalNetInputBytesObject == null) { return null; } // 关系比对 long totalNetInputBytes = NumberUtils.toLong(totalNetInputBy...
71
211
282
<methods>public non-sealed void <init>() ,public abstract List<com.sohu.cache.entity.InstanceAlertValueResult> checkConfig(com.sohu.cache.entity.InstanceAlertConfig, com.sohu.cache.alert.bean.AlertConfigBaseData) <variables>protected static final java.lang.String EMPTY,protected static final java.lang.String MB_STRING
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/alert/strategy/MinuteTotalNetOutputMBytesAlertStrategy.java
MinuteTotalNetOutputMBytesAlertStrategy
checkConfig
class MinuteTotalNetOutputMBytesAlertStrategy extends AlertConfigStrategy { @Override public List<InstanceAlertValueResult> checkConfig(InstanceAlertConfig instanceAlertConfig, AlertConfigBaseData alertConfigBaseData) {<FILL_FUNCTION_BODY>} }
Object totalNetOutputBytesObject = getValueFromDiffInfo(alertConfigBaseData.getStandardStats(), RedisInfoEnum.total_net_output_bytes.getValue()); if (totalNetOutputBytesObject == null) { return null; } // 关系比对 long totalNetOutputBytes = NumberUtils.toLong(totalNetOut...
71
210
281
<methods>public non-sealed void <init>() ,public abstract List<com.sohu.cache.entity.InstanceAlertValueResult> checkConfig(com.sohu.cache.entity.InstanceAlertConfig, com.sohu.cache.alert.bean.AlertConfigBaseData) <variables>protected static final java.lang.String EMPTY,protected static final java.lang.String MB_STRING
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/alert/strategy/MinuteUsedCpuSysChStrategy.java
MinuteUsedCpuSysChStrategy
checkConfig
class MinuteUsedCpuSysChStrategy extends AlertConfigStrategy{ @Override public List<InstanceAlertValueResult> checkConfig(InstanceAlertConfig instanceAlertConfig, AlertConfigBaseData alertConfigBaseData) {<FILL_FUNCTION_BODY>} }
Object object = getValueFromDiffInfo(alertConfigBaseData.getStandardStats(), RedisInfoEnum.used_cpu_sys_children.getValue()); if (object == null) { return null; } double min_used_cpu_sys_children_err= NumberUtils.toDouble(object.toString()); boolean compareRight = is...
70
195
265
<methods>public non-sealed void <init>() ,public abstract List<com.sohu.cache.entity.InstanceAlertValueResult> checkConfig(com.sohu.cache.entity.InstanceAlertConfig, com.sohu.cache.alert.bean.AlertConfigBaseData) <variables>protected static final java.lang.String EMPTY,protected static final java.lang.String MB_STRING
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/alert/strategy/MinuteUsedCpuSysStrategy.java
MinuteUsedCpuSysStrategy
checkConfig
class MinuteUsedCpuSysStrategy extends AlertConfigStrategy{ @Override public List<InstanceAlertValueResult> checkConfig(InstanceAlertConfig instanceAlertConfig, AlertConfigBaseData alertConfigBaseData) {<FILL_FUNCTION_BODY>} }
Object object = getValueFromDiffInfo(alertConfigBaseData.getStandardStats(), RedisInfoEnum.used_cpu_sys.getValue()); if (object == null) { return null; } double min_used_cpu_sys_err= NumberUtils.toDouble(object.toString()); boolean compareRight = isCompareDoubleRight...
69
187
256
<methods>public non-sealed void <init>() ,public abstract List<com.sohu.cache.entity.InstanceAlertValueResult> checkConfig(com.sohu.cache.entity.InstanceAlertConfig, com.sohu.cache.alert.bean.AlertConfigBaseData) <variables>protected static final java.lang.String EMPTY,protected static final java.lang.String MB_STRING
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/alert/strategy/MinuteUsedCpuUserChStrategy.java
MinuteUsedCpuUserChStrategy
checkConfig
class MinuteUsedCpuUserChStrategy extends AlertConfigStrategy{ @Override public List<InstanceAlertValueResult> checkConfig(InstanceAlertConfig instanceAlertConfig, AlertConfigBaseData alertConfigBaseData) {<FILL_FUNCTION_BODY>} }
Object object = getValueFromDiffInfo(alertConfigBaseData.getStandardStats(), RedisInfoEnum.used_cpu_user_children.getValue()); if (object == null) { return null; } double min_used_cpu_user_children_err= NumberUtils.toDouble(object.toString()); boolean compareRight = ...
69
195
264
<methods>public non-sealed void <init>() ,public abstract List<com.sohu.cache.entity.InstanceAlertValueResult> checkConfig(com.sohu.cache.entity.InstanceAlertConfig, com.sohu.cache.alert.bean.AlertConfigBaseData) <variables>protected static final java.lang.String EMPTY,protected static final java.lang.String MB_STRING
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/alert/strategy/MinuteUsedCpuUserStrategy.java
MinuteUsedCpuUserStrategy
checkConfig
class MinuteUsedCpuUserStrategy extends AlertConfigStrategy{ @Override public List<InstanceAlertValueResult> checkConfig(InstanceAlertConfig instanceAlertConfig, AlertConfigBaseData alertConfigBaseData) {<FILL_FUNCTION_BODY>} }
Object object = getValueFromDiffInfo(alertConfigBaseData.getStandardStats(), RedisInfoEnum.used_cpu_user.getValue()); if (object == null) { return null; } double min_used_cpu_user_err= NumberUtils.toDouble(object.toString()); boolean compareRight = isCompareDoubleRig...
68
187
255
<methods>public non-sealed void <init>() ,public abstract List<com.sohu.cache.entity.InstanceAlertValueResult> checkConfig(com.sohu.cache.entity.InstanceAlertConfig, com.sohu.cache.alert.bean.AlertConfigBaseData) <variables>protected static final java.lang.String EMPTY,protected static final java.lang.String MB_STRING
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/alert/strategy/RdbLastBgsaveStatusAlertStrategy.java
RdbLastBgsaveStatusAlertStrategy
checkConfig
class RdbLastBgsaveStatusAlertStrategy extends AlertConfigStrategy { @Override public List<InstanceAlertValueResult> checkConfig(InstanceAlertConfig instanceAlertConfig, AlertConfigBaseData alertConfigBaseData) {<FILL_FUNCTION_BODY>} }
Object object = getValueFromRedisInfo(alertConfigBaseData.getStandardStats(), RedisInfoEnum.rdb_last_bgsave_status.getValue()); if (object == null) { return null; } // 关系比对 String rdbLastBgsaveStatus = object.toString(); boolean compareRight = isCompareString...
71
188
259
<methods>public non-sealed void <init>() ,public abstract List<com.sohu.cache.entity.InstanceAlertValueResult> checkConfig(com.sohu.cache.entity.InstanceAlertConfig, com.sohu.cache.alert.bean.AlertConfigBaseData) <variables>protected static final java.lang.String EMPTY,protected static final java.lang.String MB_STRING
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/async/CounterRejectedExecutionHandler.java
CounterRejectedExecutionHandler
rejectedExecution
class CounterRejectedExecutionHandler implements RejectedExecutionHandler { private Logger logger = LoggerFactory.getLogger(CounterRejectedExecutionHandler.class); public static final AtomicLongMap<String> THREAD_POOL_REJECT_MAP = AtomicLongMap.create(); @Override public void rejectedExecution(Runnab...
NamedThreadFactory namedThreadFactory = (NamedThreadFactory) executor.getThreadFactory(); String threadPoolName = namedThreadFactory.getThreadPoolName(); if (StringUtils.isBlank(threadPoolName)) { logger.warn("threadPoolName is null"); return; } THREAD_POOL_REJECT_MAP.getAndIncrement(threadPoolName); ...
108
133
241
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/async/KeyCallable.java
KeyCallable
call
class KeyCallable<V> implements Callable<V> { private final String key; private volatile boolean cancelled = false; public KeyCallable(String key) { this.key = key; } public abstract V execute(); @Override public V call() throws Exception {<FILL_FUNCTION_BODY>} ...
if (!cancelled) { V v = execute(); return v; } return null;
175
38
213
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/async/NamedThreadFactory.java
NamedThreadFactory
newThread
class NamedThreadFactory implements ThreadFactory { private static final AtomicInteger POOL_SEQ = new AtomicInteger(1); private final AtomicInteger mThreadNum = new AtomicInteger(1); private final String mPrefix; private final boolean mDaemo; private final ThreadGroup mGroup; pub...
String name = mPrefix + mThreadNum.getAndIncrement(); Thread ret = new Thread(mGroup, runnable, name, 0); ret.setDaemon(mDaemo); return ret;
327
64
391
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/async/impl/AsyncServiceImpl.java
AsyncServiceImpl
assemblePool
class AsyncServiceImpl implements AsyncService { private final static String DEFAULT_THREAD_POOL = "default_thread_pool"; public final ConcurrentMap<String, ExecutorService> threadPoolMap = new ConcurrentSkipListMap<String, ExecutorService>(); private final Logger logger = LoggerFactory.getLogger(this.getCl...
ExecutorService executorService = threadPoolMap.putIfAbsent(threadPoolKey, threadPool); if (executorService != null) { logger.warn("{} is assembled", threadPoolKey); }
531
57
588
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/client/heartbeat/RedisClientController.java
RedisClientController
wrapClientParams
class RedisClientController { @Autowired private AppClientService appClientService; /** * 通过appId返回RedisCluster实例信息 * * @param appId */ @RequestMapping(value = "/redis/cluster/{appId}.json", method = RequestMethod.GET) public Map<String, Object> getClusterByAppIdAndKey(HttpServ...
String appClientIp = IpUtil.getIpAddr(request); String clientVersion = request.getParameter("clientVersion"); return new AppClientParams(appId, type, appClientIp, clientVersion);
473
57
530
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/client/heartbeat/RedisClientReportDataController.java
RedisClientReportDataController
dealAppClientReportData
class RedisClientReportDataController { private final Logger logger = LoggerFactory.getLogger(RedisClientReportDataController.class); @Autowired private DealClientReportService dealClientReportService; /** * 上报客户端上传数据 * * @param * @param model */ @RequestMapping(value = "/...
HttpStatus status = HttpStatus.CREATED; // 验证json的正确性 AppClientReportModel appClientReportModel = checkAppClientReportJson(json); if (appClientReportModel == null) { logger.error("reportWrong message: {}", json); status = HttpStatus.BAD_REQUEST; retur...
551
270
821
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/client/service/impl/AppClientReportCommandServiceImpl.java
AppClientReportCommandServiceImpl
getAppCommandClientStatistics
class AppClientReportCommandServiceImpl implements AppClientReportCommandService { @Autowired private AppClientCommandStatisticsDao appClientCommandStatisticsDao; @Autowired private ReportDataComponent reportDataComponent; @Override public void batchSave(long appId, String clientIp, long curre...
try { List<Map<String, Object>> appClientCommandStatisticsList = appClientCommandStatisticsDao.getAppCommandStatistics(appId, startTime, endTime, command, clientIp); Map<String, List<Map<String, Object>>> commandStatisticsMap = Maps.newHashMap(); appClientCommandStatisticsLi...
1,168
251
1,419
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/client/service/impl/AppClientServiceImpl.java
AppClientServiceImpl
initApps
class AppClientServiceImpl implements AppClientService { private final Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired private InstanceDao instanceDao; @Autowired private AppDao appDao; @Autowired private ClientVersionService clientVersionService; private Concurr...
long start = System.currentTimeMillis(); List<AppDesc> onlineApps = appDao.getOnlineApps(); if (onlineApps == null) { return; } Map<Long, List<InstanceInfo>> cacheInstances = Maps.newHashMap(); List<InstanceInfo> allInstances = instanceDao.getAllInsts(); ...
212
688
900
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/client/service/impl/AppInstanceClientRelationServiceImpl.java
AppInstanceClientRelationServiceImpl
batchSave
class AppInstanceClientRelationServiceImpl implements AppInstanceClientRelationService { private Logger logger = LoggerFactory.getLogger(AppInstanceClientRelationServiceImpl.class); private AppInstanceClientRelationDao appInstanceClientRelationDao; @Override public void batchSave(List<AppClien...
if (CollectionUtils.isEmpty(appClientCostTimeStatList)) { return; } try { List<AppInstanceClientRelation> appInstanceClientRelationList = new ArrayList<AppInstanceClientRelation>(); for (AppClientCostTimeStat appClientCostTimeStat : appClientCostTimeSta...
278
235
513
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/client/service/impl/ClientReportExceptionServiceImpl.java
ClientReportExceptionServiceImpl
getInstanceExceptionStat
class ClientReportExceptionServiceImpl implements ClientReportExceptionService { private final Logger logger = LoggerFactory.getLogger(ClientReportExceptionServiceImpl.class); /** * 客户端异常操作 */ private AppClientExceptionStatDao appClientExceptionStatDao; /** * host:port与instan...
try { return appClientExceptionStatDao.getInstanceExceptionStat(ip, collectTime); } catch (Exception e) { logger.error(e.getMessage(), e); return Collections.emptyList(); }
585
66
651
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/client/service/impl/ClientReportInstanceServiceImpl.java
ClientReportInstanceServiceImpl
getInstanceInfoByHostPort
class ClientReportInstanceServiceImpl implements ClientReportInstanceService { private Logger logger = LoggerFactory.getLogger(ClientReportInstanceServiceImpl.class); /** * 不要求一致性的本地缓存(hostport<=>instanceInfo) */ private final static ConcurrentHashMap<String, InstanceInfo> hostPortInstanc...
String hostPort = host + ":" + port; try { InstanceInfo instanceInfo = hostPortInstanceMap.get(hostPort); if (instanceInfo == null) { instanceInfo = instanceDao.getInstByIpAndPort(host, port); if (instanceInfo != null) { ...
200
154
354
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/client/service/impl/ClientReportValueDistriServiceImplV2.java
ClientReportValueDistriServiceImplV2
getAppValueDistriList
class ClientReportValueDistriServiceImplV2 implements ClientReportValueDistriService { private final Logger logger = LoggerFactory.getLogger(ClientReportValueDistriServiceImplV2.class); public static Set<String> excludeCommands = new HashSet<String>(); static { excludeCommands.add("ping"); ...
try { return appClientValueStatDao.getAppValueDistriList(appId, startTime, endTime); } catch (Exception e) { logger.error(e.getMessage(), e); return Collections.emptyList(); }
373
66
439
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/client/service/impl/ClientVersionServiceImpl.java
ClientVersionServiceImpl
getAppAllClientVersion
class ClientVersionServiceImpl implements ClientVersionService { private final Logger logger = LoggerFactory.getLogger(ClientVersionServiceImpl.class); private AppClientVersionDao appClientVersionDao; @Override public void saveOrUpdateClientVersion(long appId, String appClientIp, String client...
try { return appClientVersionDao.getAppAllClientVersion(appId); } catch (Exception e) { logger.error(e.getMessage(), e); return Collections.emptyList(); }
561
65
626
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/client/service/impl/DealClientReportServiceImpl.java
DealClientReportServiceImpl
deal
class DealClientReportServiceImpl implements DealClientReportService { @Autowired private AsyncService asyncService; @Autowired private AppClientReportCommandService appClientReportCommandService; @Autowired private AppClientReportExceptionService appClientReportExceptionService; @Override ...
try { // 上报的数据 final long appId = appClientReportModel.getAppId(); final String clientIp = appClientReportModel.getClientIp(); final String redisPoolConfig = JSON.toJSONString(appClientReportModel.getConfig()); final long currentMin = appClientReportM...
183
358
541
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/configuration/AsyncConfiguration.java
AsyncConfiguration
forkJoinPool
class AsyncConfiguration { private int parallelism=256; @Bean public ForkJoinPool forkJoinPool() {<FILL_FUNCTION_BODY>} }
log.info("availableProcessors:{}, parallelism:{}", Runtime.getRuntime().availableProcessors(), parallelism); ForkJoinPool forkJoinPool = new ForkJoinPool(parallelism); return forkJoinPool;
49
58
107
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/configuration/SSHPoolConfig.java
SSHPoolConfig
clientSessionPool
class SSHPoolConfig { /** * ssh连接池配置 * @return */ @Bean public GenericKeyedObjectPool<SSHMachineInfo, ClientSession> clientSessionPool() throws GeneralSecurityException, IOException {<FILL_FUNCTION_BODY>} }
GenericKeyedObjectPoolConfig genericKeyedObjectPoolConfig = new GenericKeyedObjectPoolConfig(); genericKeyedObjectPoolConfig.setTestWhileIdle(true); genericKeyedObjectPoolConfig.setTestOnReturn(true); genericKeyedObjectPoolConfig.setMaxTotalPerKey(5); genericKeyedObjectPoolConfi...
72
249
321
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/constant/AppDataMigrateResult.java
AppDataMigrateResult
isSuccess
class AppDataMigrateResult { private int status; private String message; public AppDataMigrateResult(int status, String message) { this.status = status; this.message = message; } public boolean isSuccess() {<FILL_FUNCTION_BODY>} public static AppDataMigrateResul...
if (status == 1) { return true; } return false;
366
30
396
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/constant/AppDescEnum.java
AppDescEnum
getByType
class AppDescEnum { /** * 应用类型:0 正式,1:测试 2:试用 */ public static enum AppTest { IS_TEST(1), NOT_TEST(0), IS_TRAIL(2); private int value; private AppTest(int value) { this.value = value; } public int getValue() { retu...
Optional<MaxmemoryPolicyType> policyTypeOptional = Arrays.asList(MaxmemoryPolicyType.values()).stream().filter(maxmemoryPolicyType -> maxmemoryPolicyType.type == type).findFirst(); if(policyTypeOptional.isPresent()){ return policyTypeOptional.get(); } ret...
730
80
810
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/constant/ClusterOperateResult.java
ClusterOperateResult
toString
class ClusterOperateResult { private int status; private String message; public ClusterOperateResult(int status, String message) { this.status = status; this.message = message; } public static ClusterOperateResult success() { return new ClusterOperateResult(1, ""); } ...
return "ClusterOperateResult [status=" + status + ", message=" + message + "]";
203
28
231
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/constant/CommandResult.java
CommandResult
toString
class CommandResult { private String command; private String result; private List<String> resultLines; public CommandResult(String command, String result) { super(); this.command = command; this.result = result; } public String getCommand() { ...
return "CommandResult [command=" + command + ", result=" + result + ", resultLines=" + resultLines + "]";
277
39
316
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/constant/DataFormatCheckResult.java
DataFormatCheckResult
toString
class DataFormatCheckResult { private int status; private String message; private final static int SUCCESS = 1; private final static int FAIL = 0; public DataFormatCheckResult(int status, String message) { this.status = status; this.message = message; } ...
return "DataFormatCheckResult [status=" + status + ", message=" + message + "]";
340
30
370
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/constant/HorizontalResult.java
HorizontalResult
toString
class HorizontalResult { private int status; private String message; public HorizontalResult(int status, String message) { this.status = status; this.message = message; } public static HorizontalResult checkSuccess() { return new HorizontalResult(1, "所有检查都成功,可...
return "HorizontalResult [status=" + status + ", message=" + message + "]";
305
29
334
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/constant/ImportAppResult.java
ImportAppResult
toString
class ImportAppResult { private int status; private String message; public ImportAppResult(int status, String message) { this.status = status; this.message = message; } public static ImportAppResult success() { return new ImportAppResult(1, "所有检查都成功,可以添加啦!"); ...
return "ImportAppResult [status=" + status + ", message=" + message + "]";
264
29
293
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/constant/OperateResult.java
OperateResult
toString
class OperateResult { private boolean isSuccess; private String message; private OperateResult(boolean isSuccess, String message) { this.isSuccess = isSuccess; this.message = message; } public static OperateResult success() { return new OperateResult(true, ""); } ...
return "OperateResult [isSuccess=" + isSuccess + ", message=" + message + "]";
224
29
253
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/entity/AppAudit.java
AppAudit
getStatusDesc
class AppAudit { private long id; private long appId; private long userId; private long operateId; private String userName; /** * 申请类型:AppAuditType */ private int type; /** * 预留参数1 */ private String param1; /** * 预留参数2 *...
// 0:等待审批; 1:审批通过; -1:驳回 if (status == 0) { return "等待审批"; } else if (status == 1) { return "审批通过"; } else if (status == -1) { return "驳回"; } else { return status + ""; }
682
107
789
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/entity/AppAuditLog.java
AppAuditLog
generate
class AppAuditLog implements Serializable { /** * 日志id */ private Long id; /** * 应用id */ private Long appId; /** * 审批id */ private Long appAuditId; /** * 用户id */ private Long userId; /** * 用户 *...
if(appDesc == null || appUser == null || appAuditId == null){ return null; } AppAuditLog log = new AppAuditLog(); log.setAppId(appDesc.getAppId()); log.setUserId(appUser.getId()); log.setAppAuditId(appAuditId); log.setType(type.value()); ...
403
151
554
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/entity/AppClientCostTimeStat.java
AppClientCostTimeStat
hashCode
class AppClientCostTimeStat { private long id; /** * 应用id */ private long appId; /** * 格式yyyyMMddHHmm00 */ private long collectTime; /** * 客户端ip */ private String clientIp; /** * 上报时间 */ private Date reportTime; ...
final int prime = 31; int result = 1; result = prime * result + ((clientIp == null) ? 0 : clientIp.hashCode()); result = prime * result + (int) (instanceId ^ (instanceId >>> 32)); return result;
943
80
1,023
<no_super_class>