Skip to content

Commit 825f950

Browse files
committed
mvn spotless procedure
1 parent 2370fc4 commit 825f950

26 files changed

+7806
-7806
lines changed

iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ProcedureManager.java

Lines changed: 1968 additions & 1968 deletions
Large diffs are not rendered by default.
Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
1-
/*
2-
* Licensed to the Apache Software Foundation (ASF) under one
3-
* or more contributor license agreements. See the NOTICE file
4-
* distributed with this work for additional information
5-
* regarding copyright ownership. The ASF licenses this file
6-
* to you under the Apache License, Version 2.0 (the
7-
* "License"); you may not use this file except in compliance
8-
* with the License. You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing,
13-
* software distributed under the License is distributed on an
14-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15-
* KIND, either express or implied. See the License for the
16-
* specific language governing permissions and limitations
17-
* under the License.
18-
*/
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
1919

20-
package org.apache.iotdb.confignode.procedure;
20+
package org.apache.iotdb.confignode.procedure;
2121

22-
public class CompletedProcedureContainer<Env> {
23-
private final Procedure<Env> procedure;
22+
public class CompletedProcedureContainer<Env> {
23+
private final Procedure<Env> procedure;
2424

25-
public CompletedProcedureContainer(Procedure<Env> procedure) {
26-
this.procedure = procedure;
27-
}
25+
public CompletedProcedureContainer(Procedure<Env> procedure) {
26+
this.procedure = procedure;
27+
}
2828

29-
public Procedure<Env> getProcedure() {
30-
return procedure;
31-
}
29+
public Procedure<Env> getProcedure() {
30+
return procedure;
31+
}
3232

33-
public boolean isExpired(long now, long evictTtl) {
34-
return (now - procedure.getLastUpdate()) >= evictTtl;
35-
}
33+
public boolean isExpired(long now, long evictTtl) {
34+
return (now - procedure.getLastUpdate()) >= evictTtl;
3635
}
36+
}
Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,84 @@
1-
/*
2-
* Licensed to the Apache Software Foundation (ASF) under one
3-
* or more contributor license agreements. See the NOTICE file
4-
* distributed with this work for additional information
5-
* regarding copyright ownership. The ASF licenses this file
6-
* to you under the Apache License, Version 2.0 (the
7-
* "License"); you may not use this file except in compliance
8-
* with the License. You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing,
13-
* software distributed under the License is distributed on an
14-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15-
* KIND, either express or implied. See the License for the
16-
* specific language governing permissions and limitations
17-
* under the License.
18-
*/
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
1919

20-
package org.apache.iotdb.confignode.procedure;
20+
package org.apache.iotdb.confignode.procedure;
2121

22-
import org.apache.iotdb.confignode.procedure.store.IProcedureStore;
22+
import org.apache.iotdb.confignode.procedure.store.IProcedureStore;
2323

24-
import org.slf4j.Logger;
25-
import org.slf4j.LoggerFactory;
24+
import org.slf4j.Logger;
25+
import org.slf4j.LoggerFactory;
2626

27-
import java.util.Iterator;
28-
import java.util.Map;
29-
import java.util.concurrent.TimeUnit;
27+
import java.util.Iterator;
28+
import java.util.Map;
29+
import java.util.concurrent.TimeUnit;
3030

31-
/** Internal cleaner that removes the completed procedure results after a TTL. */
32-
public class CompletedProcedureRecycler<Env> extends InternalProcedure<Env> {
33-
private static final Logger LOG = LoggerFactory.getLogger(CompletedProcedureRecycler.class);
34-
private static final int DEFAULT_BATCH_SIZE = 8;
35-
private final long evictTTL;
36-
private final Map<Long, CompletedProcedureContainer<Env>> completed;
37-
private final IProcedureStore<Env> store;
31+
/** Internal cleaner that removes the completed procedure results after a TTL. */
32+
public class CompletedProcedureRecycler<Env> extends InternalProcedure<Env> {
33+
private static final Logger LOG = LoggerFactory.getLogger(CompletedProcedureRecycler.class);
34+
private static final int DEFAULT_BATCH_SIZE = 8;
35+
private final long evictTTL;
36+
private final Map<Long, CompletedProcedureContainer<Env>> completed;
37+
private final IProcedureStore<Env> store;
3838

39-
public CompletedProcedureRecycler(
40-
IProcedureStore<Env> store,
41-
Map<Long, CompletedProcedureContainer<Env>> completedMap,
42-
long cleanTimeInterval,
43-
long evictTTL) {
44-
super(TimeUnit.SECONDS.toMillis(cleanTimeInterval));
45-
this.completed = completedMap;
46-
this.store = store;
47-
this.evictTTL = evictTTL;
48-
}
39+
public CompletedProcedureRecycler(
40+
IProcedureStore<Env> store,
41+
Map<Long, CompletedProcedureContainer<Env>> completedMap,
42+
long cleanTimeInterval,
43+
long evictTTL) {
44+
super(TimeUnit.SECONDS.toMillis(cleanTimeInterval));
45+
this.completed = completedMap;
46+
this.store = store;
47+
this.evictTTL = evictTTL;
48+
}
4949

50-
@Override
51-
protected void periodicExecute(final Env env) {
52-
if (completed.isEmpty()) {
53-
if (LOG.isTraceEnabled()) {
54-
LOG.trace("No completed procedures to cleanup.");
55-
}
56-
return;
50+
@Override
51+
protected void periodicExecute(final Env env) {
52+
if (completed.isEmpty()) {
53+
if (LOG.isTraceEnabled()) {
54+
LOG.trace("No completed procedures to cleanup.");
5755
}
56+
return;
57+
}
5858

59-
final long[] batchIds = new long[DEFAULT_BATCH_SIZE];
60-
int batchCount = 0;
59+
final long[] batchIds = new long[DEFAULT_BATCH_SIZE];
60+
int batchCount = 0;
6161

62-
final long now = System.currentTimeMillis();
63-
final Iterator<Map.Entry<Long, CompletedProcedureContainer<Env>>> it =
64-
completed.entrySet().iterator();
65-
while (it.hasNext() && store.isRunning()) {
66-
final Map.Entry<Long, CompletedProcedureContainer<Env>> entry = it.next();
67-
final CompletedProcedureContainer<Env> retainer = entry.getValue();
68-
final Procedure<?> proc = retainer.getProcedure();
69-
if (retainer.isExpired(now, evictTTL)) {
70-
// Failed procedures aren't persisted in WAL.
71-
batchIds[batchCount++] = entry.getKey();
72-
if (batchCount == batchIds.length) {
73-
store.delete(batchIds, 0, batchCount);
74-
batchCount = 0;
75-
}
76-
it.remove();
77-
LOG.trace("Evict completed {}", proc);
62+
final long now = System.currentTimeMillis();
63+
final Iterator<Map.Entry<Long, CompletedProcedureContainer<Env>>> it =
64+
completed.entrySet().iterator();
65+
while (it.hasNext() && store.isRunning()) {
66+
final Map.Entry<Long, CompletedProcedureContainer<Env>> entry = it.next();
67+
final CompletedProcedureContainer<Env> retainer = entry.getValue();
68+
final Procedure<?> proc = retainer.getProcedure();
69+
if (retainer.isExpired(now, evictTTL)) {
70+
// Failed procedures aren't persisted in WAL.
71+
batchIds[batchCount++] = entry.getKey();
72+
if (batchCount == batchIds.length) {
73+
store.delete(batchIds, 0, batchCount);
74+
batchCount = 0;
7875
}
76+
it.remove();
77+
LOG.trace("Evict completed {}", proc);
7978
}
80-
if (batchCount > 0) {
81-
store.delete(batchIds, 0, batchCount);
82-
}
79+
}
80+
if (batchCount > 0) {
81+
store.delete(batchIds, 0, batchCount);
8382
}
8483
}
84+
}
Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
1-
/*
2-
* Licensed to the Apache Software Foundation (ASF) under one
3-
* or more contributor license agreements. See the NOTICE file
4-
* distributed with this work for additional information
5-
* regarding copyright ownership. The ASF licenses this file
6-
* to you under the Apache License, Version 2.0 (the
7-
* "License"); you may not use this file except in compliance
8-
* with the License. You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing,
13-
* software distributed under the License is distributed on an
14-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15-
* KIND, either express or implied. See the License for the
16-
* specific language governing permissions and limitations
17-
* under the License.
18-
*/
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
1919

20-
package org.apache.iotdb.confignode.procedure;
20+
package org.apache.iotdb.confignode.procedure;
2121

22-
import java.io.IOException;
23-
import java.nio.ByteBuffer;
22+
import java.io.IOException;
23+
import java.nio.ByteBuffer;
2424

25-
/**
26-
* Internal Procedure, do some periodic job for framework.
27-
*
28-
* @param <Env>
29-
*/
30-
public abstract class InternalProcedure<Env> extends Procedure<Env> {
31-
protected InternalProcedure(long toMillis) {
32-
setTimeout(toMillis);
33-
}
34-
35-
protected abstract void periodicExecute(final Env env);
25+
/**
26+
* Internal Procedure, do some periodic job for framework.
27+
*
28+
* @param <Env>
29+
*/
30+
public abstract class InternalProcedure<Env> extends Procedure<Env> {
31+
protected InternalProcedure(long toMillis) {
32+
setTimeout(toMillis);
33+
}
3634

37-
@Override
38-
protected Procedure<Env>[] execute(Env env) throws InterruptedException {
39-
throw new UnsupportedOperationException();
40-
}
35+
protected abstract void periodicExecute(final Env env);
4136

42-
@Override
43-
protected void rollback(Env env) throws IOException, InterruptedException {
44-
throw new UnsupportedOperationException();
45-
}
37+
@Override
38+
protected Procedure<Env>[] execute(Env env) throws InterruptedException {
39+
throw new UnsupportedOperationException();
40+
}
4641

47-
@Override
48-
public void deserialize(ByteBuffer byteBuffer) {}
42+
@Override
43+
protected void rollback(Env env) throws IOException, InterruptedException {
44+
throw new UnsupportedOperationException();
4945
}
46+
47+
@Override
48+
public void deserialize(ByteBuffer byteBuffer) {}
49+
}

0 commit comments

Comments
 (0)