Skip to content

Commit

Permalink
fixup! fixup! make MergeOperation a Singleton
Browse files Browse the repository at this point in the history
  • Loading branch information
msbt committed Mar 16, 2015
1 parent 6a7f3c0 commit aa198cd
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sql/src/main/java/io/crate/operation/collect/StatsTables.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

package io.crate.operation.collect;

import com.google.common.base.MoreObjects;
import io.crate.core.collections.NonBlockingArrayQueue;
import io.crate.core.collections.NoopQueue;
import io.crate.metadata.settings.CrateSettings;
Expand Down Expand Up @@ -158,7 +157,7 @@ public void operationStarted(UUID operationId, UUID jobId, String name) {
}
}

public void operationFinished(@Nullable UUID operationId, @Nullable String errorMessage, @Nullable Long usedBytes) {
public void operationFinished(@Nullable UUID operationId, @Nullable String errorMessage, long usedBytes) {
if (operationId == null || !isEnabled()) {
return;
}
Expand All @@ -168,7 +167,7 @@ public void operationFinished(@Nullable UUID operationId, @Nullable String error
// been enabled before the finish
return;
}
operationContext.usedBytes = MoreObjects.firstNonNull(usedBytes, -1L);
operationContext.usedBytes = usedBytes;
BlockingQueue<OperationContextLog> operationContextLogs = operationsLog.get();
operationContextLogs.offer(new OperationContextLog(operationContext, errorMessage));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
* license agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership. Crate licenses
* this file to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may
* obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* However, if you have executed another commercial license agreement
* with Crate these terms will supersede the license and you may use the
* software solely pursuant to the terms of the relevant commercial agreement.
*/

package io.crate.operation.merge;

import org.elasticsearch.common.inject.AbstractModule;

public class MergeOperationModule extends AbstractModule {
@Override
protected void configure() {
bind(MergeOperation.class).asEagerSingleton();
}
}
2 changes: 2 additions & 0 deletions sql/src/main/java/io/crate/plugin/SQLPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import io.crate.operation.aggregation.impl.AggregationImplModule;
import io.crate.operation.collect.CollectOperationModule;
import io.crate.operation.collect.CollectShardModule;
import io.crate.operation.merge.MergeOperationModule;
import io.crate.operation.operator.OperatorModule;
import io.crate.operation.predicate.PredicateModule;
import io.crate.operation.reference.sys.cluster.SysClusterExpressionModule;
Expand Down Expand Up @@ -110,6 +111,7 @@ public Collection<Class<? extends Module>> modules() {
modules.add(CircuitBreakerModule.class);
modules.add(TransportExecutorModule.class);
modules.add(CollectOperationModule.class);
modules.add(MergeOperationModule.class);
modules.add(MetaDataModule.class);
modules.add(MetaDataSysModule.class);
modules.add(MetaDataDocModule.class);
Expand Down

0 comments on commit aa198cd

Please sign in to comment.