diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/ActionRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/ActionRequest.java index 920f48ea7ed..3011d62f576 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/ActionRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/ActionRequest.java @@ -19,7 +19,7 @@ package org.elasticsearch.action; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.Streamable; /** * @author kimchy (shay.banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/ActionResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/ActionResponse.java index fed7847a597..3ecda5471f2 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/ActionResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/ActionResponse.java @@ -19,7 +19,7 @@ package org.elasticsearch.action; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.Streamable; /** * @author kimchy (shay.banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/ShardOperationFailedException.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/ShardOperationFailedException.java index 25554c54555..645103f9488 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/ShardOperationFailedException.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/ShardOperationFailedException.java @@ -19,7 +19,7 @@ package org.elasticsearch.action; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.Streamable; import java.io.Serializable; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequest.java index 7040fdaf714..1a99b03bcf6 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequest.java @@ -21,10 +21,10 @@ package org.elasticsearch.action.admin.cluster.health; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.support.master.MasterNodeOperationRequest; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.util.Strings; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; import java.util.concurrent.TimeUnit; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponse.java index 9dff6d5b6e6..878da47de34 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponse.java @@ -22,8 +22,8 @@ package org.elasticsearch.action.admin.cluster.health; import org.elasticsearch.action.ActionResponse; import org.elasticsearch.common.collect.ImmutableList; import org.elasticsearch.common.collect.Maps; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; import java.util.Iterator; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterIndexHealth.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterIndexHealth.java index eda2944b57c..5e4960bb089 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterIndexHealth.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterIndexHealth.java @@ -21,9 +21,9 @@ package org.elasticsearch.action.admin.cluster.health; import org.elasticsearch.common.collect.ImmutableList; import org.elasticsearch.common.collect.Maps; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; import java.util.Iterator; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterShardHealth.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterShardHealth.java index e29b8555470..6f32c885712 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterShardHealth.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterShardHealth.java @@ -19,9 +19,9 @@ package org.elasticsearch.action.admin.cluster.health; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java index 575697f71e8..3c60cdc7204 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java @@ -22,6 +22,8 @@ package org.elasticsearch.action.admin.cluster.node.info; import org.elasticsearch.action.support.nodes.NodeOperationResponse; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.collect.ImmutableMap; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.monitor.jvm.JvmInfo; @@ -30,8 +32,6 @@ import org.elasticsearch.monitor.os.OsInfo; import org.elasticsearch.monitor.process.ProcessInfo; import org.elasticsearch.threadpool.ThreadPoolInfo; import org.elasticsearch.transport.TransportInfo; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; import java.util.Map; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java index a52983b1cdd..d58e94217d0 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java @@ -21,8 +21,8 @@ package org.elasticsearch.action.admin.cluster.node.info; import org.elasticsearch.action.support.nodes.NodesOperationResponse; import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/info/TransportNodesInfoAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/info/TransportNodesInfoAction.java index dd35e95fca7..a933b65becc 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/info/TransportNodesInfoAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/info/TransportNodesInfoAction.java @@ -26,12 +26,12 @@ import org.elasticsearch.action.support.nodes.TransportNodesOperationAction; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.common.collect.ImmutableMap; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.monitor.MonitorService; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.util.MapBuilder; import java.util.ArrayList; import java.util.List; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/restart/NodesRestartRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/restart/NodesRestartRequest.java index f2c1f072ab0..29814c2a4eb 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/restart/NodesRestartRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/restart/NodesRestartRequest.java @@ -20,9 +20,9 @@ package org.elasticsearch.action.admin.cluster.node.restart; import org.elasticsearch.action.support.nodes.NodesOperationRequest; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/restart/NodesRestartResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/restart/NodesRestartResponse.java index 23e901c26e3..d3b2605cc0a 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/restart/NodesRestartResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/restart/NodesRestartResponse.java @@ -23,8 +23,8 @@ import org.elasticsearch.action.support.nodes.NodeOperationResponse; import org.elasticsearch.action.support.nodes.NodesOperationResponse; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/restart/TransportNodesRestartAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/restart/TransportNodesRestartAction.java index 7776a7f6767..789d3f594a1 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/restart/TransportNodesRestartAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/restart/TransportNodesRestartAction.java @@ -27,13 +27,13 @@ import org.elasticsearch.action.support.nodes.TransportNodesOperationAction; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.node.Node; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; import java.util.List; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/NodesShutdownRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/NodesShutdownRequest.java index 043e956c90d..94592618830 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/NodesShutdownRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/NodesShutdownRequest.java @@ -20,9 +20,9 @@ package org.elasticsearch.action.admin.cluster.node.shutdown; import org.elasticsearch.action.support.nodes.NodesOperationRequest; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/NodesShutdownResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/NodesShutdownResponse.java index 4c887230a88..b9a78596a08 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/NodesShutdownResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/NodesShutdownResponse.java @@ -23,8 +23,8 @@ import org.elasticsearch.action.support.nodes.NodeOperationResponse; import org.elasticsearch.action.support.nodes.NodesOperationResponse; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/TransportNodesShutdownAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/TransportNodesShutdownAction.java index 9e619ffe1bc..2ad97f7de29 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/TransportNodesShutdownAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/TransportNodesShutdownAction.java @@ -27,13 +27,13 @@ import org.elasticsearch.action.support.nodes.TransportNodesOperationAction; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.node.Node; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; import java.util.List; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodeStats.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodeStats.java index b6bfb2bca55..9de6856db2c 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodeStats.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodeStats.java @@ -21,14 +21,14 @@ package org.elasticsearch.action.admin.cluster.node.stats; import org.elasticsearch.action.support.nodes.NodeOperationResponse; import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.monitor.jvm.JvmStats; import org.elasticsearch.monitor.network.NetworkStats; import org.elasticsearch.monitor.os.OsStats; import org.elasticsearch.monitor.process.ProcessStats; import org.elasticsearch.threadpool.ThreadPoolStats; import org.elasticsearch.transport.TransportStats; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodesStatsResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodesStatsResponse.java index 43552879eb7..2450974799c 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodesStatsResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodesStatsResponse.java @@ -21,8 +21,8 @@ package org.elasticsearch.action.admin.cluster.node.stats; import org.elasticsearch.action.support.nodes.NodesOperationResponse; import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/broadcast/BroadcastPingRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/broadcast/BroadcastPingRequest.java index 7d502b5b086..4e3654a77f8 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/broadcast/BroadcastPingRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/broadcast/BroadcastPingRequest.java @@ -21,8 +21,8 @@ package org.elasticsearch.action.admin.cluster.ping.broadcast; import org.elasticsearch.action.support.broadcast.BroadcastOperationRequest; import org.elasticsearch.action.support.broadcast.BroadcastOperationThreading; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/broadcast/BroadcastPingResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/broadcast/BroadcastPingResponse.java index 58dc6005901..f3a8721faae 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/broadcast/BroadcastPingResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/broadcast/BroadcastPingResponse.java @@ -21,8 +21,8 @@ package org.elasticsearch.action.admin.cluster.ping.broadcast; import org.elasticsearch.action.ShardOperationFailedException; import org.elasticsearch.action.support.broadcast.BroadcastOperationResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; import java.util.List; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/broadcast/BroadcastShardPingRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/broadcast/BroadcastShardPingRequest.java index 895703f814a..ffdaa7e874e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/broadcast/BroadcastShardPingRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/broadcast/BroadcastShardPingRequest.java @@ -20,8 +20,8 @@ package org.elasticsearch.action.admin.cluster.ping.broadcast; import org.elasticsearch.action.support.broadcast.BroadcastShardOperationRequest; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/broadcast/BroadcastShardPingResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/broadcast/BroadcastShardPingResponse.java index 26b93686e0a..ece8312b1ef 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/broadcast/BroadcastShardPingResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/broadcast/BroadcastShardPingResponse.java @@ -20,8 +20,8 @@ package org.elasticsearch.action.admin.cluster.ping.broadcast; import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/replication/IndexReplicationPingRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/replication/IndexReplicationPingRequest.java index cf4856b2b81..a8d9ff26cf1 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/replication/IndexReplicationPingRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/replication/IndexReplicationPingRequest.java @@ -21,9 +21,9 @@ package org.elasticsearch.action.admin.cluster.ping.replication; import org.elasticsearch.action.support.replication.IndexReplicationOperationRequest; import org.elasticsearch.action.support.replication.ReplicationType; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/replication/IndexReplicationPingResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/replication/IndexReplicationPingResponse.java index 044059d7d83..05af8124c7d 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/replication/IndexReplicationPingResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/replication/IndexReplicationPingResponse.java @@ -20,9 +20,9 @@ package org.elasticsearch.action.admin.cluster.ping.replication; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/replication/ReplicationPingResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/replication/ReplicationPingResponse.java index c3a58195b9a..60812d85bc5 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/replication/ReplicationPingResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/replication/ReplicationPingResponse.java @@ -20,9 +20,9 @@ package org.elasticsearch.action.admin.cluster.ping.replication; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; import java.util.HashMap; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/replication/ShardReplicationPingRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/replication/ShardReplicationPingRequest.java index c73f58cdc4b..82b3310eac1 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/replication/ShardReplicationPingRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/replication/ShardReplicationPingRequest.java @@ -21,8 +21,8 @@ package org.elasticsearch.action.admin.cluster.ping.replication; import org.elasticsearch.action.support.replication.ReplicationType; import org.elasticsearch.action.support.replication.ShardReplicationOperationRequest; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/replication/ShardReplicationPingResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/replication/ShardReplicationPingResponse.java index d12cbae8217..3829f06f990 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/replication/ShardReplicationPingResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/replication/ShardReplicationPingResponse.java @@ -20,9 +20,9 @@ package org.elasticsearch.action.admin.cluster.ping.replication; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/single/SinglePingRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/single/SinglePingRequest.java index 3bd207860b7..3db6d0d5a1a 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/single/SinglePingRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/single/SinglePingRequest.java @@ -20,8 +20,8 @@ package org.elasticsearch.action.admin.cluster.ping.single; import org.elasticsearch.action.support.single.SingleOperationRequest; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/single/SinglePingResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/single/SinglePingResponse.java index a9c9a6f202c..798b5051c3f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/single/SinglePingResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/ping/single/SinglePingResponse.java @@ -20,8 +20,8 @@ package org.elasticsearch.action.admin.cluster.ping.single; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequest.java index eeb766945b8..e535f1d22a5 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequest.java @@ -21,8 +21,8 @@ package org.elasticsearch.action.admin.cluster.state; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.support.master.MasterNodeOperationRequest; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateResponse.java index 35f553e9e93..7871242fd83 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateResponse.java @@ -22,8 +22,8 @@ package org.elasticsearch.action.admin.cluster.state; import org.elasticsearch.action.ActionResponse; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequest.java index 0790f3e15f2..7894203ee21 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequest.java @@ -23,8 +23,8 @@ import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.support.master.MasterNodeOperationRequest; import org.elasticsearch.cluster.metadata.AliasAction; import org.elasticsearch.common.collect.Lists; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; import java.util.List; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesResponse.java index c4948429708..ae8d928a295 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesResponse.java @@ -20,9 +20,9 @@ package org.elasticsearch.action.admin.indices.alias; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/ClearIndicesCacheRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/ClearIndicesCacheRequest.java index ddc4ac58a26..5f97441b159 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/ClearIndicesCacheRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/ClearIndicesCacheRequest.java @@ -21,8 +21,8 @@ package org.elasticsearch.action.admin.indices.cache.clear; import org.elasticsearch.action.support.broadcast.BroadcastOperationRequest; import org.elasticsearch.action.support.broadcast.BroadcastOperationThreading; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/ClearIndicesCacheResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/ClearIndicesCacheResponse.java index d6038f2269a..a5613a38ed7 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/ClearIndicesCacheResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/ClearIndicesCacheResponse.java @@ -21,8 +21,8 @@ package org.elasticsearch.action.admin.indices.cache.clear; import org.elasticsearch.action.ShardOperationFailedException; import org.elasticsearch.action.support.broadcast.BroadcastOperationResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; import java.util.List; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/ShardClearIndicesCacheRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/ShardClearIndicesCacheRequest.java index 3d75b2bfb8b..d94254e76db 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/ShardClearIndicesCacheRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/ShardClearIndicesCacheRequest.java @@ -20,8 +20,8 @@ package org.elasticsearch.action.admin.indices.cache.clear; import org.elasticsearch.action.support.broadcast.BroadcastShardOperationRequest; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/ShardClearIndicesCacheResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/ShardClearIndicesCacheResponse.java index 707f037d9fa..c1a28c97424 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/ShardClearIndicesCacheResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/ShardClearIndicesCacheResponse.java @@ -20,8 +20,8 @@ package org.elasticsearch.action.admin.indices.cache.clear; import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java index 4997870cee8..3855e79b44e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java @@ -23,6 +23,8 @@ import org.elasticsearch.ElasticSearchGenerationException; import org.elasticsearch.ElasticSearchIllegalArgumentException; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.support.master.MasterNodeOperationRequest; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; @@ -30,8 +32,6 @@ import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.builder.TextXContentBuilder; import org.elasticsearch.common.xcontent.builder.XContentBuilder; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; import java.util.Map; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexResponse.java index 9af76619bd0..dd11067d4d7 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexResponse.java @@ -20,9 +20,9 @@ package org.elasticsearch.action.admin.indices.create; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexRequest.java index 2af5591752d..ef3076428d6 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexRequest.java @@ -21,9 +21,9 @@ package org.elasticsearch.action.admin.indices.delete; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.support.master.MasterNodeOperationRequest; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexResponse.java index aa0841294cc..9ceb6cda0d5 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexResponse.java @@ -20,9 +20,9 @@ package org.elasticsearch.action.admin.indices.delete; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/flush/FlushRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/flush/FlushRequest.java index f834d80b455..9869d66fc9b 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/flush/FlushRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/flush/FlushRequest.java @@ -21,8 +21,8 @@ package org.elasticsearch.action.admin.indices.flush; import org.elasticsearch.action.support.broadcast.BroadcastOperationRequest; import org.elasticsearch.action.support.broadcast.BroadcastOperationThreading; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/flush/FlushResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/flush/FlushResponse.java index 5208af8e155..f3a6fce085a 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/flush/FlushResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/flush/FlushResponse.java @@ -21,8 +21,8 @@ package org.elasticsearch.action.admin.indices.flush; import org.elasticsearch.action.ShardOperationFailedException; import org.elasticsearch.action.support.broadcast.BroadcastOperationResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; import java.util.List; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/flush/ShardFlushRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/flush/ShardFlushRequest.java index b7efa5dc35c..e82828ce476 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/flush/ShardFlushRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/flush/ShardFlushRequest.java @@ -20,8 +20,8 @@ package org.elasticsearch.action.admin.indices.flush; import org.elasticsearch.action.support.broadcast.BroadcastShardOperationRequest; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/flush/ShardFlushResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/flush/ShardFlushResponse.java index 2e0d08ae549..c175e7b4669 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/flush/ShardFlushResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/flush/ShardFlushResponse.java @@ -20,8 +20,8 @@ package org.elasticsearch.action.admin.indices.flush; import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/gateway/snapshot/GatewaySnapshotResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/gateway/snapshot/GatewaySnapshotResponse.java index 619962b04c8..cd1aefd440f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/gateway/snapshot/GatewaySnapshotResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/gateway/snapshot/GatewaySnapshotResponse.java @@ -20,9 +20,9 @@ package org.elasticsearch.action.admin.indices.gateway.snapshot; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; import java.util.HashMap; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/gateway/snapshot/IndexGatewaySnapshotRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/gateway/snapshot/IndexGatewaySnapshotRequest.java index baa8a3161f0..be22c4a11c1 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/gateway/snapshot/IndexGatewaySnapshotRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/gateway/snapshot/IndexGatewaySnapshotRequest.java @@ -20,9 +20,9 @@ package org.elasticsearch.action.admin.indices.gateway.snapshot; import org.elasticsearch.action.support.replication.IndexReplicationOperationRequest; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/gateway/snapshot/IndexGatewaySnapshotResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/gateway/snapshot/IndexGatewaySnapshotResponse.java index 01276d60083..681e9f71426 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/gateway/snapshot/IndexGatewaySnapshotResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/gateway/snapshot/IndexGatewaySnapshotResponse.java @@ -20,9 +20,9 @@ package org.elasticsearch.action.admin.indices.gateway.snapshot; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/gateway/snapshot/ShardGatewaySnapshotRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/gateway/snapshot/ShardGatewaySnapshotRequest.java index a056c7e7179..0a55b337f22 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/gateway/snapshot/ShardGatewaySnapshotRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/gateway/snapshot/ShardGatewaySnapshotRequest.java @@ -20,8 +20,8 @@ package org.elasticsearch.action.admin.indices.gateway.snapshot; import org.elasticsearch.action.support.replication.ShardReplicationOperationRequest; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/gateway/snapshot/ShardGatewaySnapshotResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/gateway/snapshot/ShardGatewaySnapshotResponse.java index 5e88c9ca98a..f5b91d324e4 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/gateway/snapshot/ShardGatewaySnapshotResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/gateway/snapshot/ShardGatewaySnapshotResponse.java @@ -20,9 +20,9 @@ package org.elasticsearch.action.admin.indices.gateway.snapshot; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest.java index 54ec443b13c..1695004012b 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest.java @@ -23,14 +23,14 @@ import org.elasticsearch.ElasticSearchGenerationException; import org.elasticsearch.ElasticSearchIllegalArgumentException; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.support.master.MasterNodeOperationRequest; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.builder.TextXContentBuilder; import org.elasticsearch.common.xcontent.builder.XContentBuilder; import org.elasticsearch.util.Required; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; import java.util.Map; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingResponse.java index 46e7d188715..54043958a77 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingResponse.java @@ -20,9 +20,9 @@ package org.elasticsearch.action.admin.indices.mapping.put; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/optimize/OptimizeRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/optimize/OptimizeRequest.java index f9b2990794f..d07adec461a 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/optimize/OptimizeRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/optimize/OptimizeRequest.java @@ -21,8 +21,8 @@ package org.elasticsearch.action.admin.indices.optimize; import org.elasticsearch.action.support.broadcast.BroadcastOperationRequest; import org.elasticsearch.action.support.broadcast.BroadcastOperationThreading; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/optimize/OptimizeResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/optimize/OptimizeResponse.java index 9b08a3fbd76..0817fb0e18e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/optimize/OptimizeResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/optimize/OptimizeResponse.java @@ -21,8 +21,8 @@ package org.elasticsearch.action.admin.indices.optimize; import org.elasticsearch.action.ShardOperationFailedException; import org.elasticsearch.action.support.broadcast.BroadcastOperationResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; import java.util.List; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/optimize/ShardOptimizeRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/optimize/ShardOptimizeRequest.java index e7915563983..acf796de7f5 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/optimize/ShardOptimizeRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/optimize/ShardOptimizeRequest.java @@ -20,8 +20,8 @@ package org.elasticsearch.action.admin.indices.optimize; import org.elasticsearch.action.support.broadcast.BroadcastShardOperationRequest; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/optimize/ShardOptimizeResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/optimize/ShardOptimizeResponse.java index 191d71b2fb7..5b43e62e82a 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/optimize/ShardOptimizeResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/optimize/ShardOptimizeResponse.java @@ -20,8 +20,8 @@ package org.elasticsearch.action.admin.indices.optimize; import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/refresh/RefreshRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/refresh/RefreshRequest.java index 102be62a2e9..04371382606 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/refresh/RefreshRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/refresh/RefreshRequest.java @@ -21,8 +21,8 @@ package org.elasticsearch.action.admin.indices.refresh; import org.elasticsearch.action.support.broadcast.BroadcastOperationRequest; import org.elasticsearch.action.support.broadcast.BroadcastOperationThreading; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/refresh/RefreshResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/refresh/RefreshResponse.java index 3449b06f96a..0159a559d84 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/refresh/RefreshResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/refresh/RefreshResponse.java @@ -21,8 +21,8 @@ package org.elasticsearch.action.admin.indices.refresh; import org.elasticsearch.action.ShardOperationFailedException; import org.elasticsearch.action.support.broadcast.BroadcastOperationResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; import java.util.List; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/refresh/ShardRefreshRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/refresh/ShardRefreshRequest.java index 5907b1631be..66b15cdc9c0 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/refresh/ShardRefreshRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/refresh/ShardRefreshRequest.java @@ -20,8 +20,8 @@ package org.elasticsearch.action.admin.indices.refresh; import org.elasticsearch.action.support.broadcast.BroadcastShardOperationRequest; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/refresh/ShardRefreshResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/refresh/ShardRefreshResponse.java index 15f2918691a..e4158617e7f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/refresh/ShardRefreshResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/refresh/ShardRefreshResponse.java @@ -20,8 +20,8 @@ package org.elasticsearch.action.admin.indices.refresh; import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/IndicesStatusResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/IndicesStatusResponse.java index 4358267f08e..f74061e5321 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/IndicesStatusResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/IndicesStatusResponse.java @@ -23,9 +23,9 @@ import org.elasticsearch.action.ShardOperationFailedException; import org.elasticsearch.action.support.broadcast.BroadcastOperationResponse; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.common.collect.ImmutableMap; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; import java.util.List; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/ShardStatus.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/ShardStatus.java index dc61a972b99..82f72d0e53e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/ShardStatus.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/ShardStatus.java @@ -21,10 +21,10 @@ package org.elasticsearch.action.admin.indices.status; import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse; import org.elasticsearch.cluster.routing.ShardRouting; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.index.shard.IndexShardState; import org.elasticsearch.util.SizeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/count/CountRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/count/CountRequest.java index 25bd1eeff8e..a2feff3fdcb 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/count/CountRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/count/CountRequest.java @@ -26,6 +26,9 @@ import org.elasticsearch.action.Actions; import org.elasticsearch.action.support.broadcast.BroadcastOperationRequest; import org.elasticsearch.action.support.broadcast.BroadcastOperationThreading; import org.elasticsearch.client.Requests; +import org.elasticsearch.common.io.FastByteArrayOutputStream; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.builder.BinaryXContentBuilder; @@ -34,9 +37,6 @@ import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.util.Required; import org.elasticsearch.util.Strings; import org.elasticsearch.util.Unicode; -import org.elasticsearch.util.io.FastByteArrayOutputStream; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; import java.util.Arrays; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/count/CountResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/count/CountResponse.java index 6675221e0db..5402dd2cfb7 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/count/CountResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/count/CountResponse.java @@ -21,8 +21,8 @@ package org.elasticsearch.action.count; import org.elasticsearch.action.ShardOperationFailedException; import org.elasticsearch.action.support.broadcast.BroadcastOperationResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; import java.util.List; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/count/ShardCountRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/count/ShardCountRequest.java index 1ea08d3d152..ff5a7d7b191 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/count/ShardCountRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/count/ShardCountRequest.java @@ -20,9 +20,9 @@ package org.elasticsearch.action.count; import org.elasticsearch.action.support.broadcast.BroadcastShardOperationRequest; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.util.Strings; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import javax.annotation.Nullable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/count/ShardCountResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/count/ShardCountResponse.java index 949029a4b57..d5a8217bed4 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/count/ShardCountResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/count/ShardCountResponse.java @@ -20,8 +20,8 @@ package org.elasticsearch.action.count; import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/delete/DeleteRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/delete/DeleteRequest.java index e2cdf45e87c..f22833eecd8 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/delete/DeleteRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/delete/DeleteRequest.java @@ -22,10 +22,10 @@ package org.elasticsearch.action.delete; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.support.replication.ReplicationType; import org.elasticsearch.action.support.replication.ShardReplicationOperationRequest; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.util.Required; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/delete/DeleteResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/delete/DeleteResponse.java index 1ceaa05980a..4c82a0d1c28 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/delete/DeleteResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/delete/DeleteResponse.java @@ -20,9 +20,9 @@ package org.elasticsearch.action.delete; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryRequest.java index a4a3b3e6929..e461bc063ea 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryRequest.java @@ -25,6 +25,9 @@ import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.support.replication.IndicesReplicationOperationRequest; import org.elasticsearch.action.support.replication.ReplicationType; import org.elasticsearch.client.Requests; +import org.elasticsearch.common.io.FastByteArrayOutputStream; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.builder.BinaryXContentBuilder; @@ -34,9 +37,6 @@ import org.elasticsearch.util.Required; import org.elasticsearch.util.Strings; import org.elasticsearch.util.TimeValue; import org.elasticsearch.util.Unicode; -import org.elasticsearch.util.io.FastByteArrayOutputStream; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; import java.util.Arrays; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryResponse.java index 9d2ba6ba4d8..cc76a04ac4d 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryResponse.java @@ -20,9 +20,9 @@ package org.elasticsearch.action.deletebyquery; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; import java.util.Iterator; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/IndexDeleteByQueryRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/IndexDeleteByQueryRequest.java index 5f06ccc5f1f..a2087a7dc35 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/IndexDeleteByQueryRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/IndexDeleteByQueryRequest.java @@ -21,12 +21,12 @@ package org.elasticsearch.action.deletebyquery; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.support.replication.IndexReplicationOperationRequest; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.util.Required; import org.elasticsearch.util.Strings; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/IndexDeleteByQueryResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/IndexDeleteByQueryResponse.java index b8f3d956973..ed967cda9cc 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/IndexDeleteByQueryResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/IndexDeleteByQueryResponse.java @@ -20,9 +20,9 @@ package org.elasticsearch.action.deletebyquery; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/ShardDeleteByQueryRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/ShardDeleteByQueryRequest.java index 5d276a10c18..ff6455f1ca9 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/ShardDeleteByQueryRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/ShardDeleteByQueryRequest.java @@ -21,10 +21,10 @@ package org.elasticsearch.action.deletebyquery; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.support.replication.ShardReplicationOperationRequest; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.util.Strings; import org.elasticsearch.util.Unicode; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import javax.annotation.Nullable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/ShardDeleteByQueryResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/ShardDeleteByQueryResponse.java index 7705389dfe5..264e584b350 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/ShardDeleteByQueryResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/deletebyquery/ShardDeleteByQueryResponse.java @@ -20,9 +20,9 @@ package org.elasticsearch.action.deletebyquery; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/get/GetField.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/get/GetField.java index 293a4caeae7..ac748c65199 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/get/GetField.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/get/GetField.java @@ -19,9 +19,9 @@ package org.elasticsearch.action.get; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; import java.util.ArrayList; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/get/GetRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/get/GetRequest.java index 29615da3de4..d102fa4384d 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/get/GetRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/get/GetRequest.java @@ -20,9 +20,9 @@ package org.elasticsearch.action.get; import org.elasticsearch.action.support.single.SingleOperationRequest; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.util.Required; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/get/GetResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/get/GetResponse.java index c3e401d75ee..c016431c3fb 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/get/GetResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/get/GetResponse.java @@ -22,12 +22,12 @@ package org.elasticsearch.action.get; import org.elasticsearch.ElasticSearchParseException; import org.elasticsearch.action.ActionResponse; import org.elasticsearch.common.collect.ImmutableMap; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.util.Unicode; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; import java.io.IOException; import java.util.Iterator; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/index/IndexRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/index/IndexRequest.java index 7e0b60a4635..5405f49ec95 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/index/IndexRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/index/IndexRequest.java @@ -25,6 +25,8 @@ import org.elasticsearch.ElasticSearchIllegalArgumentException; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.support.replication.ReplicationType; import org.elasticsearch.action.support.replication.ShardReplicationOperationRequest; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.builder.BinaryXContentBuilder; @@ -32,8 +34,6 @@ import org.elasticsearch.common.xcontent.builder.XContentBuilder; import org.elasticsearch.util.Required; import org.elasticsearch.util.TimeValue; import org.elasticsearch.util.Unicode; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; import java.util.Arrays; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/index/IndexResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/index/IndexResponse.java index 71e82f78e09..e9e022d505a 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/index/IndexResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/index/IndexResponse.java @@ -20,9 +20,9 @@ package org.elasticsearch.action.index; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/mlt/MoreLikeThisRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/mlt/MoreLikeThisRequest.java index abc44f7ec11..2d1ad46543c 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/mlt/MoreLikeThisRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/mlt/MoreLikeThisRequest.java @@ -27,6 +27,9 @@ import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.Actions; import org.elasticsearch.action.search.SearchType; import org.elasticsearch.client.Requests; +import org.elasticsearch.common.io.FastByteArrayOutputStream; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.builder.BinaryXContentBuilder; @@ -37,9 +40,6 @@ import org.elasticsearch.util.Bytes; import org.elasticsearch.util.Required; import org.elasticsearch.util.Strings; import org.elasticsearch.util.Unicode; -import org.elasticsearch.util.io.FastByteArrayOutputStream; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; import java.util.Arrays; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/SearchRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/SearchRequest.java index e884d97a3e1..ee13b416c08 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/SearchRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/SearchRequest.java @@ -25,6 +25,9 @@ import org.elasticsearch.ElasticSearchIllegalArgumentException; import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.client.Requests; +import org.elasticsearch.common.io.FastByteArrayOutputStream; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.builder.BinaryXContentBuilder; @@ -35,9 +38,6 @@ import org.elasticsearch.util.Bytes; import org.elasticsearch.util.Strings; import org.elasticsearch.util.TimeValue; import org.elasticsearch.util.Unicode; -import org.elasticsearch.util.io.FastByteArrayOutputStream; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; import java.util.Arrays; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/SearchResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/SearchResponse.java index 7aeec7d23ec..39eca55bedd 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/SearchResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/SearchResponse.java @@ -20,13 +20,13 @@ package org.elasticsearch.action.search; import org.elasticsearch.action.ActionResponse; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.builder.XContentBuilder; import org.elasticsearch.search.SearchHits; import org.elasticsearch.search.facets.Facets; import org.elasticsearch.search.internal.InternalSearchResponse; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/SearchScrollRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/SearchScrollRequest.java index e9151b4b590..a5315bc37b6 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/SearchScrollRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/SearchScrollRequest.java @@ -21,10 +21,10 @@ package org.elasticsearch.action.search; import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionRequestValidationException; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.search.Scroll; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/ShardSearchFailure.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/ShardSearchFailure.java index 67463f12eed..7f9e190196f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/ShardSearchFailure.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/ShardSearchFailure.java @@ -21,10 +21,10 @@ package org.elasticsearch.action.search; import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.action.ShardOperationFailedException; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.search.SearchException; import org.elasticsearch.search.SearchShardTarget; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import javax.annotation.Nullable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/ParsedScrollId.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/ParsedScrollId.java index 114de4aedc3..ae4968e9e24 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/ParsedScrollId.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/ParsedScrollId.java @@ -19,7 +19,7 @@ package org.elasticsearch.action.search.type; -import org.elasticsearch.util.Tuple; +import org.elasticsearch.common.collect.Tuple; /** * @author kimchy (shay.banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchCache.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchCache.java index 12a347a156c..ab324463a95 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchCache.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchCache.java @@ -20,12 +20,12 @@ package org.elasticsearch.action.search.type; import org.elasticsearch.action.search.ShardSearchFailure; +import org.elasticsearch.common.util.concurrent.jsr166y.LinkedTransferQueue; import org.elasticsearch.search.SearchShardTarget; import org.elasticsearch.search.dfs.DfsSearchResult; import org.elasticsearch.search.fetch.FetchSearchResult; import org.elasticsearch.search.fetch.QueryFetchSearchResult; import org.elasticsearch.search.query.QuerySearchResultProvider; -import org.elasticsearch.util.concurrent.jsr166y.LinkedTransferQueue; import java.util.Collection; import java.util.Map; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchHelper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchHelper.java index b85eb8ff84c..c0c8da4bff4 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchHelper.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchHelper.java @@ -26,11 +26,11 @@ import org.elasticsearch.action.search.SearchScrollRequest; import org.elasticsearch.action.search.SearchType; import org.elasticsearch.action.search.ShardSearchFailure; import org.elasticsearch.cluster.routing.ShardRouting; +import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.search.SearchPhaseResult; import org.elasticsearch.search.internal.InternalScrollSearchRequest; import org.elasticsearch.search.internal.InternalSearchRequest; import org.elasticsearch.util.Base64; -import org.elasticsearch.util.Tuple; import org.elasticsearch.util.Unicode; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryAndFetchAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryAndFetchAction.java index 8f057dcb375..e7092d84a1e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryAndFetchAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryAndFetchAction.java @@ -24,6 +24,7 @@ import org.elasticsearch.action.search.*; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; +import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; @@ -35,7 +36,6 @@ import org.elasticsearch.search.controller.ShardDoc; import org.elasticsearch.search.fetch.QueryFetchSearchResult; import org.elasticsearch.search.internal.InternalSearchResponse; import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.util.Tuple; import java.util.Collection; import java.util.Map; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryThenFetchAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryThenFetchAction.java index 39848fa304b..d0e24051d1e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryThenFetchAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryThenFetchAction.java @@ -24,6 +24,7 @@ import org.elasticsearch.action.search.*; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; +import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; @@ -39,7 +40,6 @@ import org.elasticsearch.search.internal.InternalSearchResponse; import org.elasticsearch.search.query.QuerySearchResult; import org.elasticsearch.search.query.QuerySearchResultProvider; import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.util.Tuple; import java.util.Collection; import java.util.Map; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/AdapterActionFuture.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/AdapterActionFuture.java index 4407909e717..788f469c79f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/AdapterActionFuture.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/AdapterActionFuture.java @@ -24,9 +24,9 @@ import org.elasticsearch.ElasticSearchInterruptedException; import org.elasticsearch.ElasticSearchTimeoutException; import org.elasticsearch.action.ActionFuture; import org.elasticsearch.action.ActionListener; -import org.elasticsearch.transport.TransportException; +import org.elasticsearch.common.util.concurrent.AbstractFuture; +import org.elasticsearch.common.util.concurrent.UncategorizedExecutionException; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.concurrent.AbstractFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; @@ -46,7 +46,7 @@ public abstract class AdapterActionFuture extends AbstractFuture implem if (e.getCause() instanceof ElasticSearchException) { throw (ElasticSearchException) e.getCause(); } else { - throw new TransportException("Failed execution", e); + throw new UncategorizedExecutionException("Failed execution", e); } } } @@ -74,7 +74,7 @@ public abstract class AdapterActionFuture extends AbstractFuture implem if (e.getCause() instanceof ElasticSearchException) { throw (ElasticSearchException) e.getCause(); } else { - throw new ElasticSearchException("Failed execution", e); + throw new UncategorizedExecutionException("Failed execution", e); } } } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/DefaultShardOperationFailedException.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/DefaultShardOperationFailedException.java index d978bb670d8..a9bb8fb375a 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/DefaultShardOperationFailedException.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/DefaultShardOperationFailedException.java @@ -20,9 +20,9 @@ package org.elasticsearch.action.support; import org.elasticsearch.action.ShardOperationFailedException; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.index.shard.IndexShardException; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastOperationRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastOperationRequest.java index 1cd49883586..19a9da5c4dc 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastOperationRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastOperationRequest.java @@ -21,9 +21,9 @@ package org.elasticsearch.action.support.broadcast; import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionRequestValidationException; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.util.Strings; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import javax.annotation.Nullable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastOperationResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastOperationResponse.java index f260bbe407d..27ca932511a 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastOperationResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastOperationResponse.java @@ -22,8 +22,8 @@ package org.elasticsearch.action.support.broadcast; import org.elasticsearch.action.ActionResponse; import org.elasticsearch.action.ShardOperationFailedException; import org.elasticsearch.common.collect.ImmutableList; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; import java.util.ArrayList; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastShardOperationRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastShardOperationRequest.java index 5af176bdd26..40ac5b32c79 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastShardOperationRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastShardOperationRequest.java @@ -19,9 +19,9 @@ package org.elasticsearch.action.support.broadcast; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastShardOperationResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastShardOperationResponse.java index ff0761bc2b2..8cefb082fa2 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastShardOperationResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastShardOperationResponse.java @@ -19,9 +19,9 @@ package org.elasticsearch.action.support.broadcast; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/TransportBroadcastOperationAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/TransportBroadcastOperationAction.java index b62cd5c80b8..f0c8eea5d1e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/TransportBroadcastOperationAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/broadcast/TransportBroadcastOperationAction.java @@ -30,16 +30,16 @@ import org.elasticsearch.cluster.routing.GroupShardsIterator; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.ShardsIterator; import org.elasticsearch.common.collect.ImmutableList; +import org.elasticsearch.common.io.ThrowableObjectInputStream; +import org.elasticsearch.common.io.ThrowableObjectOutputStream; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.indices.IndicesService; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.*; -import org.elasticsearch.util.io.ThrowableObjectInputStream; -import org.elasticsearch.util.io.ThrowableObjectOutputStream; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; import java.io.IOException; import java.util.List; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/master/MasterNodeOperationRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/master/MasterNodeOperationRequest.java index 7e8aab905a8..930f0d6ff74 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/master/MasterNodeOperationRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/master/MasterNodeOperationRequest.java @@ -20,8 +20,8 @@ package org.elasticsearch.action.support.master; import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/NodeOperationRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/NodeOperationRequest.java index d73ecb113a4..5ac1862129b 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/NodeOperationRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/NodeOperationRequest.java @@ -19,9 +19,9 @@ package org.elasticsearch.action.support.nodes; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/NodeOperationResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/NodeOperationResponse.java index 0f06430cf3a..91cfc681796 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/NodeOperationResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/NodeOperationResponse.java @@ -20,9 +20,9 @@ package org.elasticsearch.action.support.nodes; import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/NodesOperationRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/NodesOperationRequest.java index d0bc2cfed25..3c84f116228 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/NodesOperationRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/NodesOperationRequest.java @@ -21,9 +21,9 @@ package org.elasticsearch.action.support.nodes; import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionRequestValidationException; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.util.Strings; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/NodesOperationResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/NodesOperationResponse.java index 00a39b7f618..2c78b663b19 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/NodesOperationResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/nodes/NodesOperationResponse.java @@ -22,8 +22,8 @@ package org.elasticsearch.action.support.nodes; import org.elasticsearch.action.ActionResponse; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.common.collect.Maps; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; import java.util.Iterator; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/replication/IndexReplicationOperationRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/replication/IndexReplicationOperationRequest.java index 820ce5ec095..c7b5f9fae9b 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/replication/IndexReplicationOperationRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/replication/IndexReplicationOperationRequest.java @@ -21,9 +21,9 @@ package org.elasticsearch.action.support.replication; import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionRequestValidationException; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/replication/IndicesReplicationOperationRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/replication/IndicesReplicationOperationRequest.java index 0686bb9fd2b..0ac04c68d4e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/replication/IndicesReplicationOperationRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/replication/IndicesReplicationOperationRequest.java @@ -21,9 +21,9 @@ package org.elasticsearch.action.support.replication; import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionRequestValidationException; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/replication/ShardReplicationOperationRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/replication/ShardReplicationOperationRequest.java index b6c59589ad3..3a7a21a36bb 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/replication/ShardReplicationOperationRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/replication/ShardReplicationOperationRequest.java @@ -21,9 +21,9 @@ package org.elasticsearch.action.support.replication; import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionRequestValidationException; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; import java.util.concurrent.TimeUnit; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/replication/TransportShardReplicationOperationAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/replication/TransportShardReplicationOperationAction.java index 249c8d3047c..76e7f8eda95 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/replication/TransportShardReplicationOperationAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/replication/TransportShardReplicationOperationAction.java @@ -33,6 +33,10 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.ShardsIterator; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; +import org.elasticsearch.common.io.stream.VoidStreamable; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.IndexShardMissingException; import org.elasticsearch.index.shard.IllegalIndexShardStateException; @@ -43,10 +47,6 @@ import org.elasticsearch.indices.IndicesService; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.*; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; -import org.elasticsearch.util.io.stream.VoidStreamable; import java.io.IOException; import java.util.concurrent.atomic.AtomicBoolean; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/single/SingleOperationRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/single/SingleOperationRequest.java index cb55db02635..ee6770695ad 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/single/SingleOperationRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/single/SingleOperationRequest.java @@ -22,8 +22,8 @@ package org.elasticsearch.action.support.single; import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.Actions; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/single/TransportSingleOperationAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/single/TransportSingleOperationAction.java index 24c5ee0e267..91c6cc62663 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/single/TransportSingleOperationAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/single/TransportSingleOperationAction.java @@ -30,13 +30,13 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.ShardsIterator; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.indices.IndicesService; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.*; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/FieldTermsFreq.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/FieldTermsFreq.java index d165b1f0916..94a1755fd00 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/FieldTermsFreq.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/FieldTermsFreq.java @@ -20,10 +20,10 @@ package org.elasticsearch.action.terms; import org.elasticsearch.common.collect.Iterators; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.trove.ExtTObjectIntHasMap; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; import java.io.IOException; import java.util.Iterator; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/ShardTermsRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/ShardTermsRequest.java index 0ad26787d56..89e17e6666b 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/ShardTermsRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/ShardTermsRequest.java @@ -20,8 +20,8 @@ package org.elasticsearch.action.terms; import org.elasticsearch.action.support.broadcast.BroadcastShardOperationRequest; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/ShardTermsResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/ShardTermsResponse.java index cf80203a398..58fe23d1049 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/ShardTermsResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/ShardTermsResponse.java @@ -20,11 +20,11 @@ package org.elasticsearch.action.terms; import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.common.trove.TObjectIntHashMap; import org.elasticsearch.common.trove.TObjectIntIterator; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; import java.util.HashMap; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/TermFreq.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/TermFreq.java index 54bde39d2c9..394454cbe90 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/TermFreq.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/TermFreq.java @@ -19,10 +19,10 @@ package org.elasticsearch.action.terms; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.lucene.Lucene; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; import java.io.IOException; import java.util.Comparator; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/TermsRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/TermsRequest.java index 609d45b3177..b5060867add 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/TermsRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/TermsRequest.java @@ -22,9 +22,9 @@ package org.elasticsearch.action.terms; import org.elasticsearch.ElasticSearchIllegalArgumentException; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.support.broadcast.BroadcastOperationRequest; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.index.mapper.AllFieldMapper; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/TermsResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/TermsResponse.java index 58a1e9932c1..2b14528d1d5 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/TermsResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/TermsResponse.java @@ -22,8 +22,8 @@ package org.elasticsearch.action.terms; import org.elasticsearch.action.ShardOperationFailedException; import org.elasticsearch.action.support.broadcast.BroadcastOperationResponse; import org.elasticsearch.common.collect.Iterators; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; import java.util.HashMap; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/TransportTermsAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/TransportTermsAction.java index 645c664967c..ca206d8854a 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/TransportTermsAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/terms/TransportTermsAction.java @@ -34,6 +34,7 @@ import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.routing.GroupShardsIterator; import org.elasticsearch.cluster.routing.ShardRouting; +import org.elasticsearch.common.collect.BoundedTreeSet; import org.elasticsearch.common.collect.Maps; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; @@ -46,7 +47,6 @@ import org.elasticsearch.index.shard.service.IndexShard; import org.elasticsearch.indices.IndicesService; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.util.BoundedTreeSet; import javax.annotation.Nullable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java b/modules/elasticsearch/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java index 71eb8579a25..c9c1369ab0d 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java @@ -21,8 +21,10 @@ package org.elasticsearch.bootstrap; import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.Version; +import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.inject.CreationException; import org.elasticsearch.common.inject.spi.Message; +import org.elasticsearch.common.jline.ANSI; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.logging.log4j.LogConfigurator; @@ -33,8 +35,6 @@ import org.elasticsearch.node.Node; import org.elasticsearch.node.NodeBuilder; import org.elasticsearch.node.internal.InternalSettingsPerparer; import org.elasticsearch.util.Classes; -import org.elasticsearch.util.Tuple; -import org.elasticsearch.util.jline.ANSI; import java.io.File; import java.util.Set; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/TransportClient.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/TransportClient.java index 0074556d11f..0038d96b8f1 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/TransportClient.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/TransportClient.java @@ -45,6 +45,7 @@ import org.elasticsearch.client.transport.support.InternalTransportClient; import org.elasticsearch.cluster.ClusterNameModule; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.collect.ImmutableList; +import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.inject.Guice; import org.elasticsearch.common.inject.Injector; import org.elasticsearch.common.inject.Module; @@ -64,7 +65,6 @@ import org.elasticsearch.timer.TimerService; import org.elasticsearch.transport.TransportModule; import org.elasticsearch.transport.TransportService; import org.elasticsearch.util.ThreadLocals; -import org.elasticsearch.util.Tuple; import java.util.ArrayList; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/ClusterName.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/ClusterName.java index 7b1c27d3721..e2f3e81b39c 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/ClusterName.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/ClusterName.java @@ -19,10 +19,10 @@ package org.elasticsearch.cluster; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/ClusterState.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/ClusterState.java index a5c803edd26..62ac0530875 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/ClusterState.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/ClusterState.java @@ -24,11 +24,11 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.RoutingNodes; import org.elasticsearch.cluster.routing.RoutingTable; +import org.elasticsearch.common.io.stream.BytesStreamInput; +import org.elasticsearch.common.io.stream.BytesStreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.util.io.stream.BytesStreamInput; -import org.elasticsearch.util.io.stream.BytesStreamOutput; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import javax.annotation.Nullable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/MappingUpdatedAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/MappingUpdatedAction.java index afa9cdb5ecb..0be21e0d1b5 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/MappingUpdatedAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/MappingUpdatedAction.java @@ -27,11 +27,11 @@ import org.elasticsearch.action.support.master.TransportMasterNodeOperationActio import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.metadata.MetaDataService; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexCreatedAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexCreatedAction.java index d70b1b9616a..8a7bdb8281a 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexCreatedAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexCreatedAction.java @@ -24,16 +24,16 @@ import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; +import org.elasticsearch.common.io.stream.VoidStreamable; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.BaseTransportRequestHandler; import org.elasticsearch.transport.TransportChannel; import org.elasticsearch.transport.TransportService; import org.elasticsearch.transport.VoidTransportResponseHandler; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; -import org.elasticsearch.util.io.stream.VoidStreamable; import java.io.IOException; import java.util.List; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexDeletedAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexDeletedAction.java index 905915829dd..cab9d84228c 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexDeletedAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexDeletedAction.java @@ -24,16 +24,16 @@ import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; +import org.elasticsearch.common.io.stream.VoidStreamable; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.BaseTransportRequestHandler; import org.elasticsearch.transport.TransportChannel; import org.elasticsearch.transport.TransportService; import org.elasticsearch.transport.VoidTransportResponseHandler; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; -import org.elasticsearch.util.io.stream.VoidStreamable; import java.io.IOException; import java.util.List; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeMappingCreatedAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeMappingCreatedAction.java index 34a1ce720bc..98cb5222e02 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeMappingCreatedAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/index/NodeMappingCreatedAction.java @@ -24,16 +24,16 @@ import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; +import org.elasticsearch.common.io.stream.VoidStreamable; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.BaseTransportRequestHandler; import org.elasticsearch.transport.TransportChannel; import org.elasticsearch.transport.TransportService; import org.elasticsearch.transport.VoidTransportResponseHandler; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; -import org.elasticsearch.util.io.stream.VoidStreamable; import java.io.IOException; import java.util.List; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java index 87ad5667c17..5a3780689e0 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java @@ -31,16 +31,16 @@ import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.strategy.ShardsRoutingStrategy; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; +import org.elasticsearch.common.io.stream.VoidStreamable; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.BaseTransportRequestHandler; import org.elasticsearch.transport.TransportChannel; import org.elasticsearch.transport.TransportService; import org.elasticsearch.transport.VoidTransportResponseHandler; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; -import org.elasticsearch.util.io.stream.VoidStreamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/AliasAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/AliasAction.java index 89417ab3676..bb322e4e0b4 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/AliasAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/AliasAction.java @@ -20,9 +20,9 @@ package org.elasticsearch.cluster.metadata; import org.elasticsearch.ElasticSearchIllegalArgumentException; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/IndexMetaData.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/IndexMetaData.java index 38214c4d400..a2a91a55c20 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/IndexMetaData.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/IndexMetaData.java @@ -21,17 +21,17 @@ package org.elasticsearch.cluster.metadata; import org.elasticsearch.common.collect.ImmutableMap; import org.elasticsearch.common.collect.ImmutableSet; +import org.elasticsearch.common.collect.MapBuilder; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.util.concurrent.Immutable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.builder.XContentBuilder; -import org.elasticsearch.util.MapBuilder; import org.elasticsearch.util.Preconditions; -import org.elasticsearch.util.concurrent.Immutable; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import javax.annotation.Nullable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java index bcb9b52651a..a58a98e193c 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java @@ -20,11 +20,11 @@ package org.elasticsearch.cluster.metadata; import org.elasticsearch.ElasticSearchIllegalArgumentException; -import org.elasticsearch.common.collect.ImmutableMap; -import org.elasticsearch.common.collect.ImmutableSet; -import org.elasticsearch.common.collect.Lists; -import org.elasticsearch.common.collect.UnmodifiableIterator; +import org.elasticsearch.common.collect.*; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.util.concurrent.Immutable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; @@ -33,17 +33,13 @@ import org.elasticsearch.common.xcontent.builder.TextXContentBuilder; import org.elasticsearch.common.xcontent.builder.XContentBuilder; import org.elasticsearch.index.Index; import org.elasticsearch.indices.IndexMissingException; -import org.elasticsearch.util.MapBuilder; -import org.elasticsearch.util.concurrent.Immutable; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import javax.annotation.Nullable; import java.io.IOException; import java.util.*; +import static org.elasticsearch.common.collect.MapBuilder.*; import static org.elasticsearch.common.collect.Sets.*; -import static org.elasticsearch.util.MapBuilder.*; /** * @author kimchy (shay.banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/MetaDataService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/MetaDataService.java index 9edde6deac9..763ca0b3f33 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/MetaDataService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/MetaDataService.java @@ -30,8 +30,10 @@ import org.elasticsearch.cluster.routing.IndexRoutingTable; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.cluster.routing.strategy.ShardsRoutingStrategy; import org.elasticsearch.common.collect.Maps; +import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.Streams; import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; @@ -47,8 +49,6 @@ import org.elasticsearch.indices.IndicesService; import org.elasticsearch.indices.InvalidIndexNameException; import org.elasticsearch.util.Strings; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.Tuple; -import org.elasticsearch.util.io.Streams; import java.io.File; import java.io.FileReader; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/DiscoveryNode.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/DiscoveryNode.java index a7cfe177d20..5e742301e30 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/DiscoveryNode.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/DiscoveryNode.java @@ -22,12 +22,12 @@ package org.elasticsearch.cluster.node; import org.elasticsearch.common.collect.ImmutableList; import org.elasticsearch.common.collect.ImmutableMap; import org.elasticsearch.common.collect.Maps; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.common.transport.TransportAddressSerializers; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; import java.io.IOException; import java.io.Serializable; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/DiscoveryNodes.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/DiscoveryNodes.java index 95c7adb31b1..c22a4aea4ca 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/DiscoveryNodes.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/DiscoveryNodes.java @@ -22,9 +22,9 @@ package org.elasticsearch.cluster.node; import org.elasticsearch.common.collect.ImmutableList; import org.elasticsearch.common.collect.ImmutableMap; import org.elasticsearch.common.collect.UnmodifiableIterator; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.transport.TransportAddress; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import javax.annotation.Nullable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/GroupShardsIterator.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/GroupShardsIterator.java index 40d4d305a3d..89296e7cbbb 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/GroupShardsIterator.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/GroupShardsIterator.java @@ -19,7 +19,7 @@ package org.elasticsearch.cluster.routing; -import org.elasticsearch.util.IdentityHashSet; +import org.elasticsearch.common.collect.IdentityHashSet; import java.util.Iterator; import java.util.Set; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/ImmutableShardRouting.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/ImmutableShardRouting.java index 6478bf94904..5a140550eb7 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/ImmutableShardRouting.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/ImmutableShardRouting.java @@ -20,10 +20,10 @@ package org.elasticsearch.cluster.routing; import org.elasticsearch.common.collect.ImmutableList; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.index.shard.ShardId; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; import java.io.IOException; import java.io.Serializable; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/IndexRoutingTable.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/IndexRoutingTable.java index f865c8629f2..f249a115b47 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/IndexRoutingTable.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/IndexRoutingTable.java @@ -21,13 +21,13 @@ package org.elasticsearch.cluster.routing; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.common.collect.IdentityHashSet; import org.elasticsearch.common.collect.ImmutableMap; import org.elasticsearch.common.collect.Sets; import org.elasticsearch.common.collect.UnmodifiableIterator; -import org.elasticsearch.util.IdentityHashSet; -import org.elasticsearch.util.concurrent.Immutable; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.util.concurrent.Immutable; import java.io.IOException; import java.util.HashMap; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/IndexShardRoutingTable.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/IndexShardRoutingTable.java index 747621955ab..6249d9cfde9 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/IndexShardRoutingTable.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/IndexShardRoutingTable.java @@ -22,10 +22,10 @@ package org.elasticsearch.cluster.routing; import org.elasticsearch.common.collect.ImmutableList; import org.elasticsearch.common.collect.Lists; import org.elasticsearch.common.collect.UnmodifiableIterator; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.util.concurrent.jsr166y.ThreadLocalRandom; import org.elasticsearch.index.shard.ShardId; -import org.elasticsearch.util.concurrent.jsr166y.ThreadLocalRandom; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; import java.util.Iterator; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/RoutingNodes.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/RoutingNodes.java index bbe30889c47..cf4ac7c7304 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/RoutingNodes.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/RoutingNodes.java @@ -20,7 +20,7 @@ package org.elasticsearch.cluster.routing; import org.elasticsearch.cluster.metadata.MetaData; -import org.elasticsearch.util.concurrent.NotThreadSafe; +import org.elasticsearch.common.util.concurrent.NotThreadSafe; import java.util.*; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/RoutingTable.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/RoutingTable.java index 6cd4e17d079..3ba3a3deb50 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/RoutingTable.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/RoutingTable.java @@ -24,11 +24,11 @@ import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.common.collect.ImmutableMap; import org.elasticsearch.common.collect.Lists; import org.elasticsearch.common.collect.UnmodifiableIterator; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.util.concurrent.Immutable; import org.elasticsearch.index.Index; import org.elasticsearch.indices.IndexMissingException; -import org.elasticsearch.util.concurrent.Immutable; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; import java.util.List; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/RoutingTableValidation.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/RoutingTableValidation.java index dd31d091e8f..9dec5f35b32 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/RoutingTableValidation.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/RoutingTableValidation.java @@ -22,9 +22,9 @@ package org.elasticsearch.cluster.routing; import org.elasticsearch.common.collect.ImmutableList; import org.elasticsearch.common.collect.ImmutableMap; import org.elasticsearch.common.collect.Lists; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; import java.io.Serializable; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/ShardRouting.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/ShardRouting.java index cac38d9cfea..26d94b1065f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/ShardRouting.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/ShardRouting.java @@ -19,10 +19,10 @@ package org.elasticsearch.cluster.routing; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.index.shard.ShardId; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; import java.io.IOException; import java.io.Serializable; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java index a3d113bd62d..78368f7154c 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java @@ -39,8 +39,8 @@ import java.util.concurrent.TimeUnit; import static java.util.concurrent.Executors.*; import static org.elasticsearch.cluster.ClusterState.*; +import static org.elasticsearch.common.util.concurrent.DynamicExecutors.*; import static org.elasticsearch.util.TimeValue.*; -import static org.elasticsearch.util.concurrent.DynamicExecutors.*; /** * @author kimchy (shay.banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/BoundedTreeSet.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/collect/BoundedTreeSet.java similarity index 97% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/BoundedTreeSet.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/collect/BoundedTreeSet.java index 533a0a191b8..9c9d936df6f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/BoundedTreeSet.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/collect/BoundedTreeSet.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util; +package org.elasticsearch.common.collect; import java.util.Collection; import java.util.Comparator; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/IdentityHashSet.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/collect/IdentityHashSet.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/IdentityHashSet.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/collect/IdentityHashSet.java index 86b604ae68d..c6fbce44df1 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/IdentityHashSet.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/collect/IdentityHashSet.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util; +package org.elasticsearch.common.collect; import java.util.*; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/MapBackedSet.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/collect/MapBackedSet.java similarity index 97% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/MapBackedSet.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/collect/MapBackedSet.java index cfa1d01a538..becca926693 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/MapBackedSet.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/collect/MapBackedSet.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util; +package org.elasticsearch.common.collect; import java.io.Serializable; import java.util.AbstractSet; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/MapBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/collect/MapBuilder.java similarity index 95% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/MapBuilder.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/collect/MapBuilder.java index 3a101062559..d5b4a93bb8d 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/MapBuilder.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/collect/MapBuilder.java @@ -17,9 +17,7 @@ * under the License. */ -package org.elasticsearch.util; - -import org.elasticsearch.common.collect.ImmutableMap; +package org.elasticsearch.common.collect; import java.util.Map; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/ReusableIterator.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/collect/ReusableIterator.java similarity index 95% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/ReusableIterator.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/collect/ReusableIterator.java index ad5a7a60e76..1340fdeb1b0 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/ReusableIterator.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/collect/ReusableIterator.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util; +package org.elasticsearch.common.collect; import java.util.Iterator; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/SafeArray.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/collect/SafeArray.java similarity index 97% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/SafeArray.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/collect/SafeArray.java index dbf3d7a50f8..929fd312dc8 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/SafeArray.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/collect/SafeArray.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util; +package org.elasticsearch.common.collect; /** * An array that is safe in terms of size. diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/Tuple.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/collect/Tuple.java similarity index 96% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/Tuple.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/collect/Tuple.java index 26db3f91175..95287629512 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/Tuple.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/collect/Tuple.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util; +package org.elasticsearch.common.collect; /** * @author kimchy (Shay Banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/component/Lifecycle.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/component/Lifecycle.java index 3ccb8ab99ae..cce01046284 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/component/Lifecycle.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/component/Lifecycle.java @@ -20,7 +20,7 @@ package org.elasticsearch.common.component; import org.elasticsearch.ElasticSearchIllegalStateException; -import org.elasticsearch.util.concurrent.ThreadSafe; +import org.elasticsearch.common.util.concurrent.ThreadSafe; /** * Lifecycle state. Allows the following transitions: diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/BooleanStreamable.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/BooleanStreamable.java similarity index 87% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/BooleanStreamable.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/BooleanStreamable.java index 195c5136353..eddea7305be 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/BooleanStreamable.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/BooleanStreamable.java @@ -17,11 +17,11 @@ * under the License. */ -package org.elasticsearch.util.io; +package org.elasticsearch.common.io; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/ByteArrayDataInputStream.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/ByteArrayDataInputStream.java similarity index 92% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/ByteArrayDataInputStream.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/ByteArrayDataInputStream.java index 823064c3f0a..f37a6f8c9d6 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/ByteArrayDataInputStream.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/ByteArrayDataInputStream.java @@ -17,9 +17,9 @@ * under the License. */ -package org.elasticsearch.util.io; +package org.elasticsearch.common.io; -import org.elasticsearch.util.concurrent.NotThreadSafe; +import org.elasticsearch.common.util.concurrent.NotThreadSafe; import java.io.DataInputStream; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/ByteArrayDataOutputStream.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/ByteArrayDataOutputStream.java similarity index 95% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/ByteArrayDataOutputStream.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/ByteArrayDataOutputStream.java index 9df488bd84d..1939093a2c3 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/ByteArrayDataOutputStream.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/ByteArrayDataOutputStream.java @@ -17,10 +17,10 @@ * under the License. */ -package org.elasticsearch.util.io; +package org.elasticsearch.common.io; +import org.elasticsearch.common.util.concurrent.NotThreadSafe; import org.elasticsearch.util.ThreadLocals; -import org.elasticsearch.util.concurrent.NotThreadSafe; import java.io.DataOutputStream; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/CharSequenceReader.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/CharSequenceReader.java similarity index 96% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/CharSequenceReader.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/CharSequenceReader.java index 4057267aa19..c8646a12bbd 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/CharSequenceReader.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/CharSequenceReader.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io; +package org.elasticsearch.common.io; import java.io.Reader; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/CompactObjectInputStream.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/CompactObjectInputStream.java similarity index 98% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/CompactObjectInputStream.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/CompactObjectInputStream.java index 88d8dfce77b..106546595df 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/CompactObjectInputStream.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/CompactObjectInputStream.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io; +package org.elasticsearch.common.io; import org.elasticsearch.util.Classes; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/CompactObjectOutputStream.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/CompactObjectOutputStream.java similarity index 97% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/CompactObjectOutputStream.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/CompactObjectOutputStream.java index 24d4f3d0c53..c44711d3072 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/CompactObjectOutputStream.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/CompactObjectOutputStream.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io; +package org.elasticsearch.common.io; import java.io.IOException; import java.io.ObjectOutputStream; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/FastByteArrayInputStream.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/FastByteArrayInputStream.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/FastByteArrayInputStream.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/FastByteArrayInputStream.java index 5d2dea566dd..25bd077cb8c 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/FastByteArrayInputStream.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/FastByteArrayInputStream.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io; +package org.elasticsearch.common.io; import java.io.IOException; import java.io.InputStream; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/FastByteArrayOutputStream.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/FastByteArrayOutputStream.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/FastByteArrayOutputStream.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/FastByteArrayOutputStream.java index 0f407837c36..2db7c1ecbc3 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/FastByteArrayOutputStream.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/FastByteArrayOutputStream.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io; +package org.elasticsearch.common.io; import org.elasticsearch.util.ThreadLocals; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/FastCharArrayReader.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/FastCharArrayReader.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/FastCharArrayReader.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/FastCharArrayReader.java index 32f954296d2..7d5506bbdfb 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/FastCharArrayReader.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/FastCharArrayReader.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io; +package org.elasticsearch.common.io; import java.io.IOException; import java.io.Reader; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/FastCharArrayWriter.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/FastCharArrayWriter.java similarity index 98% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/FastCharArrayWriter.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/FastCharArrayWriter.java index f3119d882b3..ba173e22e3e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/FastCharArrayWriter.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/FastCharArrayWriter.java @@ -17,10 +17,10 @@ * under the License. */ -package org.elasticsearch.util.io; +package org.elasticsearch.common.io; +import org.elasticsearch.common.util.concurrent.NotThreadSafe; import org.elasticsearch.util.ThreadLocals; -import org.elasticsearch.util.concurrent.NotThreadSafe; import java.io.IOException; import java.io.Writer; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/FastDataOutputStream.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/FastDataOutputStream.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/FastDataOutputStream.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/FastDataOutputStream.java index f590774334d..b36bec3b3ab 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/FastDataOutputStream.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/FastDataOutputStream.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io; +package org.elasticsearch.common.io; import java.io.*; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/FastStringReader.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/FastStringReader.java similarity index 98% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/FastStringReader.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/FastStringReader.java index 9ccd7949ac9..a701e882949 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/FastStringReader.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/FastStringReader.java @@ -17,9 +17,9 @@ * under the License. */ -package org.elasticsearch.util.io; +package org.elasticsearch.common.io; -import org.elasticsearch.util.concurrent.NotThreadSafe; +import org.elasticsearch.common.util.concurrent.NotThreadSafe; import java.io.IOException; import java.io.Reader; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/FileSystemUtils.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/FileSystemUtils.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/FileSystemUtils.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/FileSystemUtils.java index f6fb092b325..dc06d330433 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/FileSystemUtils.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/FileSystemUtils.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io; +package org.elasticsearch.common.io; import java.io.*; import java.nio.channels.FileChannel; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/Serializers.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/Serializers.java similarity index 98% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/Serializers.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/Serializers.java index 0aa382f3148..599c025d1c5 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/Serializers.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/Serializers.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io; +package org.elasticsearch.common.io; import java.io.DataInput; import java.io.DataOutput; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/Streams.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/Streams.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/Streams.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/Streams.java index d140fba4500..1390e96af02 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/Streams.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/Streams.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io; +package org.elasticsearch.common.io; import org.elasticsearch.util.Preconditions; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/StringBuilderWriter.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/StringBuilderWriter.java similarity index 98% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/StringBuilderWriter.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/StringBuilderWriter.java index c89c05944c5..384694cdfd4 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/StringBuilderWriter.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/StringBuilderWriter.java @@ -17,10 +17,10 @@ * under the License. */ -package org.elasticsearch.util.io; +package org.elasticsearch.common.io; +import org.elasticsearch.common.util.concurrent.NotThreadSafe; import org.elasticsearch.util.ThreadLocals; -import org.elasticsearch.util.concurrent.NotThreadSafe; import java.io.Writer; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/ThrowableObjectInputStream.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/ThrowableObjectInputStream.java similarity index 98% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/ThrowableObjectInputStream.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/ThrowableObjectInputStream.java index ad3ce1a7746..432f62cc1b4 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/ThrowableObjectInputStream.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/ThrowableObjectInputStream.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io; +package org.elasticsearch.common.io; import java.io.*; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/ThrowableObjectOutputStream.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/ThrowableObjectOutputStream.java similarity index 98% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/ThrowableObjectOutputStream.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/ThrowableObjectOutputStream.java index b0039ad8451..83c465a82f8 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/ThrowableObjectOutputStream.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/ThrowableObjectOutputStream.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io; +package org.elasticsearch.common.io; import java.io.IOException; import java.io.ObjectOutputStream; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/CompressedString.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/CompressedString.java similarity index 90% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/CompressedString.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/CompressedString.java index 46631b6a72f..2fffb818d09 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/CompressedString.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/CompressedString.java @@ -17,11 +17,11 @@ * under the License. */ -package org.elasticsearch.util.io.compression; +package org.elasticsearch.common.io.compression; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/Compressor.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/Compressor.java similarity index 95% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/Compressor.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/Compressor.java index 5fc4178455d..50db1386a2b 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/Compressor.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/Compressor.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io.compression; +package org.elasticsearch.common.io.compression; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/GZIPCompressor.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/GZIPCompressor.java similarity index 95% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/GZIPCompressor.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/GZIPCompressor.java index 3c13a20610d..8f04bf3f973 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/GZIPCompressor.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/GZIPCompressor.java @@ -17,14 +17,14 @@ * under the License. */ -package org.elasticsearch.util.io.compression; +package org.elasticsearch.common.io.compression; import org.apache.lucene.util.UnicodeUtil; +import org.elasticsearch.common.io.FastByteArrayInputStream; +import org.elasticsearch.common.io.FastByteArrayOutputStream; import org.elasticsearch.util.SizeUnit; import org.elasticsearch.util.ThreadLocals; import org.elasticsearch.util.Unicode; -import org.elasticsearch.util.io.FastByteArrayInputStream; -import org.elasticsearch.util.io.FastByteArrayOutputStream; import java.io.IOException; import java.util.zip.GZIPInputStream; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/LzfCompressor.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/LzfCompressor.java similarity index 93% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/LzfCompressor.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/LzfCompressor.java index 0e2f2a36ac1..531a60ba256 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/LzfCompressor.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/LzfCompressor.java @@ -17,13 +17,13 @@ * under the License. */ -package org.elasticsearch.util.io.compression; +package org.elasticsearch.common.io.compression; import org.apache.lucene.util.UnicodeUtil; +import org.elasticsearch.common.io.compression.lzf.LZFDecoder; +import org.elasticsearch.common.io.compression.lzf.LZFEncoder; import org.elasticsearch.util.ThreadLocals; import org.elasticsearch.util.Unicode; -import org.elasticsearch.util.io.compression.lzf.LZFDecoder; -import org.elasticsearch.util.io.compression.lzf.LZFEncoder; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/ZipCompressor.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/ZipCompressor.java similarity index 97% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/ZipCompressor.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/ZipCompressor.java index 9222b834b29..c027b958f50 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/ZipCompressor.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/ZipCompressor.java @@ -17,13 +17,13 @@ * under the License. */ -package org.elasticsearch.util.io.compression; +package org.elasticsearch.common.io.compression; import org.apache.lucene.util.UnicodeUtil; +import org.elasticsearch.common.io.FastByteArrayOutputStream; import org.elasticsearch.util.SizeUnit; import org.elasticsearch.util.ThreadLocals; import org.elasticsearch.util.Unicode; -import org.elasticsearch.util.io.FastByteArrayOutputStream; import java.io.IOException; import java.util.zip.DataFormatException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/lzf/ChunkEncoder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/lzf/ChunkEncoder.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/lzf/ChunkEncoder.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/lzf/ChunkEncoder.java index d6a41fecb37..38a72332185 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/lzf/ChunkEncoder.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/lzf/ChunkEncoder.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io.compression.lzf; +package org.elasticsearch.common.io.compression.lzf; /** * Class that handles actual encoding of individual chunks. diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/lzf/LZFChunk.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/lzf/LZFChunk.java similarity index 98% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/lzf/LZFChunk.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/lzf/LZFChunk.java index 5078fb20239..ca8e5c17aea 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/lzf/LZFChunk.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/lzf/LZFChunk.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io.compression.lzf; +package org.elasticsearch.common.io.compression.lzf; /** * Helper class used to store LZF encoded segments (compressed and non-compressed) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/lzf/LZFDecoder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/lzf/LZFDecoder.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/lzf/LZFDecoder.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/lzf/LZFDecoder.java index c7b0c94c681..03a633aac2b 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/lzf/LZFDecoder.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/lzf/LZFDecoder.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io.compression.lzf; +package org.elasticsearch.common.io.compression.lzf; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/lzf/LZFEncoder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/lzf/LZFEncoder.java similarity index 98% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/lzf/LZFEncoder.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/lzf/LZFEncoder.java index 73c68e0f2cf..0d5f3c7d4d9 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/compression/lzf/LZFEncoder.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/compression/lzf/LZFEncoder.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io.compression.lzf; +package org.elasticsearch.common.io.compression.lzf; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/BytesStreamInput.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/BytesStreamInput.java similarity index 98% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/BytesStreamInput.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/BytesStreamInput.java index b97dd838632..aa658d302bb 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/BytesStreamInput.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/BytesStreamInput.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io.stream; +package org.elasticsearch.common.io.stream; import org.elasticsearch.util.Unicode; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/BytesStreamOutput.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/BytesStreamOutput.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/BytesStreamOutput.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/BytesStreamOutput.java index c8b06855087..339145a56fa 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/BytesStreamOutput.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/BytesStreamOutput.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io.stream; +package org.elasticsearch.common.io.stream; import org.elasticsearch.util.ThreadLocals; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/DataInputStreamInput.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/DataInputStreamInput.java similarity index 97% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/DataInputStreamInput.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/DataInputStreamInput.java index 4c79561e590..d35dbeff3b5 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/DataInputStreamInput.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/DataInputStreamInput.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io.stream; +package org.elasticsearch.common.io.stream; import java.io.Closeable; import java.io.DataInput; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/DataOutputStreamOutput.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/DataOutputStreamOutput.java similarity index 97% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/DataOutputStreamOutput.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/DataOutputStreamOutput.java index 1179e30666f..741beac817f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/DataOutputStreamOutput.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/DataOutputStreamOutput.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io.stream; +package org.elasticsearch.common.io.stream; import java.io.Closeable; import java.io.DataOutput; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/HandlesStreamInput.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/HandlesStreamInput.java similarity index 98% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/HandlesStreamInput.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/HandlesStreamInput.java index 2d57fde089b..ea174a02da2 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/HandlesStreamInput.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/HandlesStreamInput.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io.stream; +package org.elasticsearch.common.io.stream; import org.elasticsearch.common.trove.TIntObjectHashMap; import org.elasticsearch.util.ThreadLocals; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/HandlesStreamOutput.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/HandlesStreamOutput.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/HandlesStreamOutput.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/HandlesStreamOutput.java index 8c47dca47d9..a86d90cf013 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/HandlesStreamOutput.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/HandlesStreamOutput.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io.stream; +package org.elasticsearch.common.io.stream; import org.elasticsearch.common.trove.ExtTObjectIntHasMap; import org.elasticsearch.common.trove.TObjectIntHashMap; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/InputStreamStreamInput.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/InputStreamStreamInput.java similarity index 97% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/InputStreamStreamInput.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/InputStreamStreamInput.java index 2c53958ac37..ec50480e138 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/InputStreamStreamInput.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/InputStreamStreamInput.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io.stream; +package org.elasticsearch.common.io.stream; import java.io.EOFException; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/LongStreamable.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/LongStreamable.java similarity index 96% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/LongStreamable.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/LongStreamable.java index cf0343c4a49..c447720b5db 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/LongStreamable.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/LongStreamable.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io.stream; +package org.elasticsearch.common.io.stream; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/OutputStreamStreamOutput.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/OutputStreamStreamOutput.java similarity index 97% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/OutputStreamStreamOutput.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/OutputStreamStreamOutput.java index b99657c342f..c4afeea9a77 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/OutputStreamStreamOutput.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/OutputStreamStreamOutput.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io.stream; +package org.elasticsearch.common.io.stream; import java.io.IOException; import java.io.OutputStream; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/StreamInput.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/StreamInput.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/StreamInput.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/StreamInput.java index 36f727cdeac..61c940a7bde 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/StreamInput.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/StreamInput.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io.stream; +package org.elasticsearch.common.io.stream; import org.elasticsearch.util.Bytes; import org.elasticsearch.util.Unicode; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/StreamOutput.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/StreamOutput.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/StreamOutput.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/StreamOutput.java index 7714d835479..ac3e966c58b 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/StreamOutput.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/StreamOutput.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io.stream; +package org.elasticsearch.common.io.stream; import org.apache.lucene.util.UnicodeUtil; import org.elasticsearch.util.Unicode; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/Streamable.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/Streamable.java similarity index 95% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/Streamable.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/Streamable.java index 824c5d95b2d..d4736df1903 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/Streamable.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/Streamable.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io.stream; +package org.elasticsearch.common.io.stream; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/StringStreamable.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/StringStreamable.java similarity index 97% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/StringStreamable.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/StringStreamable.java index b2bee187fca..d17a42b2f5f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/StringStreamable.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/StringStreamable.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io.stream; +package org.elasticsearch.common.io.stream; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/VoidStreamable.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/VoidStreamable.java similarity index 96% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/VoidStreamable.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/VoidStreamable.java index f6ba90778be..21d024479ff 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/io/stream/VoidStreamable.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/io/stream/VoidStreamable.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.io.stream; +package org.elasticsearch.common.io.stream; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/jline/ANSI.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/jline/ANSI.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/jline/ANSI.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/jline/ANSI.java index 91501447d47..604c0631c51 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/jline/ANSI.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/jline/ANSI.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.jline; +package org.elasticsearch.common.jline; import jline.ANSIBuffer; import jline.Terminal; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/joda/FormatDateTimeFormatter.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/joda/FormatDateTimeFormatter.java index f97a05cd095..f1130bb2843 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/joda/FormatDateTimeFormatter.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/joda/FormatDateTimeFormatter.java @@ -20,7 +20,7 @@ package org.elasticsearch.common.joda; import org.elasticsearch.common.joda.time.format.DateTimeFormatter; -import org.elasticsearch.util.concurrent.Immutable; +import org.elasticsearch.common.util.concurrent.Immutable; /** * A simple wrapper around {@link DateTimeFormatter} that retains the diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/lease/Releasable.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lease/Releasable.java similarity index 96% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/lease/Releasable.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/lease/Releasable.java index 6b85be38a78..9b487c64bff 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/lease/Releasable.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lease/Releasable.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.lease; +package org.elasticsearch.common.lease; import org.elasticsearch.ElasticSearchException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/logging/log4j/JLinePatternLayout.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/logging/log4j/JLinePatternLayout.java index 6dde3d063b9..14ef03f3c6f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/logging/log4j/JLinePatternLayout.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/logging/log4j/JLinePatternLayout.java @@ -25,17 +25,17 @@ import org.apache.log4j.helpers.FormattingInfo; import org.apache.log4j.helpers.PatternConverter; import org.apache.log4j.helpers.PatternParser; import org.apache.log4j.spi.LoggingEvent; -import org.elasticsearch.util.jline.ANSI; +import org.elasticsearch.common.jline.ANSI; import java.lang.reflect.Field; import static jline.ANSIBuffer.ANSICodes.*; -import static org.elasticsearch.util.jline.ANSI.Code.FG_BLUE; -import static org.elasticsearch.util.jline.ANSI.Code.FG_CYAN; -import static org.elasticsearch.util.jline.ANSI.Code.FG_GREEN; -import static org.elasticsearch.util.jline.ANSI.Code.FG_RED; -import static org.elasticsearch.util.jline.ANSI.Code.FG_YELLOW; -import static org.elasticsearch.util.jline.ANSI.Code.OFF; +import static org.elasticsearch.common.jline.ANSI.Code.FG_BLUE; +import static org.elasticsearch.common.jline.ANSI.Code.FG_CYAN; +import static org.elasticsearch.common.jline.ANSI.Code.FG_GREEN; +import static org.elasticsearch.common.jline.ANSI.Code.FG_RED; +import static org.elasticsearch.common.jline.ANSI.Code.FG_YELLOW; +import static org.elasticsearch.common.jline.ANSI.Code.OFF; /** * @author kimchy (Shay Banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/logging/log4j/LogConfigurator.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/logging/log4j/LogConfigurator.java index b07552e6d0a..4183adf2cf8 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/logging/log4j/LogConfigurator.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/logging/log4j/LogConfigurator.java @@ -21,11 +21,11 @@ package org.elasticsearch.common.logging.log4j; import org.apache.log4j.PropertyConfigurator; import org.elasticsearch.common.collect.ImmutableMap; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.env.FailedToResolveConfigException; -import org.elasticsearch.util.MapBuilder; import java.util.Map; import java.util.Properties; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/Directories.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/Directories.java index 36c763ea00c..670a382612b 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/Directories.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/Directories.java @@ -28,7 +28,7 @@ import org.elasticsearch.util.SizeValue; import java.io.*; import java.util.Collection; -import static org.elasticsearch.util.io.FileSystemUtils.*; +import static org.elasticsearch.common.io.FileSystemUtils.*; /** * A set of utilities for Lucene {@link Directory}. diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/Lucene.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/Lucene.java index cf24db87163..ff7e75c725a 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/Lucene.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/Lucene.java @@ -27,10 +27,10 @@ import org.apache.lucene.index.Term; import org.apache.lucene.index.TermDocs; import org.apache.lucene.search.*; import org.apache.lucene.util.Version; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.trove.TIntArrayList; import org.elasticsearch.index.analysis.NamedAnalyzer; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/ReaderSearcherHolder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/ReaderSearcherHolder.java index 64ebe7af9b5..fb8e8675855 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/ReaderSearcherHolder.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/ReaderSearcherHolder.java @@ -22,7 +22,7 @@ package org.elasticsearch.common.lucene; import org.apache.lucene.index.IndexReader; import org.apache.lucene.search.IndexSearcher; import org.elasticsearch.ElasticSearchException; -import org.elasticsearch.util.lease.Releasable; +import org.elasticsearch.common.lease.Releasable; /** * A very simple holder for a tuple of reader and searcher. diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/all/AllEntries.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/all/AllEntries.java index 69288ca6219..539485bcaf8 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/all/AllEntries.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/all/AllEntries.java @@ -21,9 +21,9 @@ package org.elasticsearch.common.lucene.all; import org.elasticsearch.ElasticSearchIllegalStateException; import org.elasticsearch.common.collect.Lists; -import org.elasticsearch.util.io.CharSequenceReader; -import org.elasticsearch.util.io.FastCharArrayWriter; -import org.elasticsearch.util.io.FastStringReader; +import org.elasticsearch.common.io.CharSequenceReader; +import org.elasticsearch.common.io.FastCharArrayWriter; +import org.elasticsearch.common.io.FastStringReader; import java.io.IOException; import java.io.Reader; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/search/MoreLikeThisQuery.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/search/MoreLikeThisQuery.java index 329fb54bd5e..9150722d3b7 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/search/MoreLikeThisQuery.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/search/MoreLikeThisQuery.java @@ -23,7 +23,7 @@ import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.index.IndexReader; import org.apache.lucene.search.*; import org.apache.lucene.search.similar.MoreLikeThis; -import org.elasticsearch.util.io.FastStringReader; +import org.elasticsearch.common.io.FastStringReader; import java.io.IOException; import java.util.Set; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/versioned/ConcurrentVersionedMap.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/versioned/ConcurrentVersionedMap.java index ca75d20eaa3..22059c5b4ad 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/versioned/ConcurrentVersionedMap.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/versioned/ConcurrentVersionedMap.java @@ -19,7 +19,7 @@ package org.elasticsearch.common.lucene.versioned; -import org.elasticsearch.util.concurrent.ThreadSafe; +import org.elasticsearch.common.util.concurrent.ThreadSafe; import java.util.concurrent.ConcurrentHashMap; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/versioned/ConcurrentVersionedMapLong.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/versioned/ConcurrentVersionedMapLong.java index 3a8e86f7331..bef126d3eb3 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/versioned/ConcurrentVersionedMapLong.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/versioned/ConcurrentVersionedMapLong.java @@ -19,12 +19,12 @@ package org.elasticsearch.common.lucene.versioned; -import org.elasticsearch.util.concurrent.ConcurrentCollections; -import org.elasticsearch.util.concurrent.ConcurrentMapLong; -import org.elasticsearch.util.concurrent.ThreadSafe; +import org.elasticsearch.common.util.concurrent.ConcurrentCollections; +import org.elasticsearch.common.util.concurrent.ConcurrentMapLong; +import org.elasticsearch.common.util.concurrent.ThreadSafe; /** - * An implementation of {@link VersionedMap} based on {@link ConcurrentMapLong}. + * An implementation of {@link VersionedMap} based on {@link org.elasticsearch.common.util.concurrent.ConcurrentMapLong}. * * @author kimchy (Shay Banon) */ diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/versioned/NativeVersionedMap.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/versioned/NativeVersionedMap.java index aec2cf0094c..272aa6848fd 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/versioned/NativeVersionedMap.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/versioned/NativeVersionedMap.java @@ -20,7 +20,7 @@ package org.elasticsearch.common.lucene.versioned; import org.elasticsearch.common.trove.ExtTIntIntHashMap; -import org.elasticsearch.util.concurrent.ThreadSafe; +import org.elasticsearch.common.util.concurrent.ThreadSafe; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/versioned/VersionedIndexReader.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/versioned/VersionedIndexReader.java index 701104d4b39..7892328f36f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/versioned/VersionedIndexReader.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/versioned/VersionedIndexReader.java @@ -20,7 +20,7 @@ package org.elasticsearch.common.lucene.versioned; import org.apache.lucene.index.*; -import org.elasticsearch.util.concurrent.ThreadSafe; +import org.elasticsearch.common.util.concurrent.ThreadSafe; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/versioned/VersionedMap.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/versioned/VersionedMap.java index 5e1e6d563ec..cbe94710d54 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/versioned/VersionedMap.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/versioned/VersionedMap.java @@ -19,7 +19,7 @@ package org.elasticsearch.common.lucene.versioned; -import org.elasticsearch.util.concurrent.ThreadSafe; +import org.elasticsearch.common.util.concurrent.ThreadSafe; /** * A versioned map, allowing to put version numbers associated with specific diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/math/MathRuntimeException.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/math/MathRuntimeException.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/math/MathRuntimeException.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/math/MathRuntimeException.java index 550b0f0663e..ec85d0d1638 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/math/MathRuntimeException.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/math/MathRuntimeException.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.math; +package org.elasticsearch.common.math; import java.io.EOFException; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/math/MathUtils.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/math/MathUtils.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/math/MathUtils.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/math/MathUtils.java index 64b033794a5..57fb29ebf04 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/math/MathUtils.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/math/MathUtils.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.math; +package org.elasticsearch.common.math; import java.math.BigDecimal; import java.math.BigInteger; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/math/UnboxedMathUtils.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/math/UnboxedMathUtils.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/math/UnboxedMathUtils.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/math/UnboxedMathUtils.java index cdeec5d5d70..7983ec2fc68 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/math/UnboxedMathUtils.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/math/UnboxedMathUtils.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.math; +package org.elasticsearch.common.math; /** * @author kimchy (shay.banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/netty/OpenChannelsHandler.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/netty/OpenChannelsHandler.java index 386a1e80451..d4319e05274 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/netty/OpenChannelsHandler.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/netty/OpenChannelsHandler.java @@ -20,7 +20,7 @@ package org.elasticsearch.common.netty; import org.elasticsearch.common.netty.channel.*; -import org.elasticsearch.util.concurrent.ConcurrentCollections; +import org.elasticsearch.common.util.concurrent.ConcurrentCollections; import java.util.Set; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/network/NetworkService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/network/NetworkService.java index 4e92d186982..8f9be6f5b05 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/network/NetworkService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/network/NetworkService.java @@ -20,10 +20,10 @@ package org.elasticsearch.common.network; import org.elasticsearch.common.collect.ImmutableMap; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.util.MapBuilder; import java.io.IOException; import java.net.InetAddress; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/path/PathTrie.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/path/PathTrie.java index 81c7f167a17..552c8cfd2e3 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/path/PathTrie.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/path/PathTrie.java @@ -24,7 +24,7 @@ import org.elasticsearch.common.collect.ImmutableMap; import java.util.Map; import java.util.regex.Pattern; -import static org.elasticsearch.util.MapBuilder.*; +import static org.elasticsearch.common.collect.MapBuilder.*; /** * @author kimchy (Shay Banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/PropertyPlaceholder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/property/PropertyPlaceholder.java similarity index 98% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/PropertyPlaceholder.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/property/PropertyPlaceholder.java index 4b6b8eca85a..38e57419d4a 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/PropertyPlaceholder.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/property/PropertyPlaceholder.java @@ -17,7 +17,10 @@ * under the License. */ -package org.elasticsearch.util; +package org.elasticsearch.common.property; + +import org.elasticsearch.util.Preconditions; +import org.elasticsearch.util.Strings; import java.util.HashSet; import java.util.Properties; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/settings/ImmutableSettings.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/settings/ImmutableSettings.java index 93a3b1c0f7e..a2ff45fbd10 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/settings/ImmutableSettings.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/settings/ImmutableSettings.java @@ -19,14 +19,15 @@ package org.elasticsearch.common.settings; +import org.elasticsearch.common.io.Streams; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.property.PropertyPlaceholder; import org.elasticsearch.common.settings.loader.SettingsLoader; import org.elasticsearch.common.settings.loader.SettingsLoaderFactory; +import org.elasticsearch.common.util.concurrent.Immutable; +import org.elasticsearch.common.util.concurrent.ThreadSafe; import org.elasticsearch.util.*; -import org.elasticsearch.util.concurrent.Immutable; -import org.elasticsearch.util.concurrent.ThreadSafe; -import org.elasticsearch.util.io.Streams; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; import java.io.InputStream; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/settings/Settings.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/settings/Settings.java index b133ebb5a59..2ca8317c7d3 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/settings/Settings.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/settings/Settings.java @@ -19,9 +19,9 @@ package org.elasticsearch.common.settings; +import org.elasticsearch.common.util.concurrent.ThreadSafe; import org.elasticsearch.util.SizeValue; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.concurrent.ThreadSafe; import java.util.Map; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/settings/loader/PropertiesSettingsLoader.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/settings/loader/PropertiesSettingsLoader.java index 56cd35fcefc..c8fd81ebe3f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/settings/loader/PropertiesSettingsLoader.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/settings/loader/PropertiesSettingsLoader.java @@ -19,8 +19,8 @@ package org.elasticsearch.common.settings.loader; -import org.elasticsearch.util.io.FastByteArrayInputStream; -import org.elasticsearch.util.io.FastStringReader; +import org.elasticsearch.common.io.FastByteArrayInputStream; +import org.elasticsearch.common.io.FastStringReader; import java.io.IOException; import java.util.Map; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/settings/loader/YamlSettingsLoader.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/settings/loader/YamlSettingsLoader.java index 20a44035855..a7d9796aa2d 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/settings/loader/YamlSettingsLoader.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/settings/loader/YamlSettingsLoader.java @@ -19,8 +19,8 @@ package org.elasticsearch.common.settings.loader; +import org.elasticsearch.common.io.FastByteArrayInputStream; import org.elasticsearch.common.yaml.snakeyaml.Yaml; -import org.elasticsearch.util.io.FastByteArrayInputStream; import java.io.IOException; import java.util.List; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/timer/HashedWheelTimer.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/timer/HashedWheelTimer.java index e0183df01c1..5dc2fc22237 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/timer/HashedWheelTimer.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/timer/HashedWheelTimer.java @@ -19,11 +19,11 @@ package org.elasticsearch.common.timer; +import org.elasticsearch.common.collect.MapBackedSet; +import org.elasticsearch.common.collect.ReusableIterator; import org.elasticsearch.common.logging.ESLogger; -import org.elasticsearch.util.MapBackedSet; -import org.elasticsearch.util.ReusableIterator; +import org.elasticsearch.common.util.concurrent.ConcurrentIdentityHashMap; import org.elasticsearch.util.ThreadRenamingRunnable; -import org.elasticsearch.util.concurrent.ConcurrentIdentityHashMap; import java.util.*; import java.util.concurrent.ThreadFactory; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/transport/BoundTransportAddress.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/transport/BoundTransportAddress.java index 19a0259debb..97e6ee5c33b 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/transport/BoundTransportAddress.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/transport/BoundTransportAddress.java @@ -19,9 +19,9 @@ package org.elasticsearch.common.transport; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/transport/DummyTransportAddress.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/transport/DummyTransportAddress.java index 3506129c93f..74c3d4a3c42 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/transport/DummyTransportAddress.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/transport/DummyTransportAddress.java @@ -19,8 +19,8 @@ package org.elasticsearch.common.transport; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/transport/InetSocketTransportAddress.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/transport/InetSocketTransportAddress.java index 505ee9f7c8e..d568264d388 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/transport/InetSocketTransportAddress.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/transport/InetSocketTransportAddress.java @@ -19,8 +19,8 @@ package org.elasticsearch.common.transport; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; import java.net.InetAddress; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/transport/LocalTransportAddress.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/transport/LocalTransportAddress.java index a35efbc440b..0520dae9fb4 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/transport/LocalTransportAddress.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/transport/LocalTransportAddress.java @@ -19,8 +19,8 @@ package org.elasticsearch.common.transport; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/transport/TransportAddress.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/transport/TransportAddress.java index 0c69ed111d6..452523f2842 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/transport/TransportAddress.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/transport/TransportAddress.java @@ -19,7 +19,7 @@ package org.elasticsearch.common.transport; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.Streamable; import java.io.Serializable; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/transport/TransportAddressSerializers.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/transport/TransportAddressSerializers.java index b9098f47f57..38d24288151 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/transport/TransportAddressSerializers.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/transport/TransportAddressSerializers.java @@ -21,15 +21,15 @@ package org.elasticsearch.common.transport; import org.elasticsearch.ElasticSearchIllegalStateException; import org.elasticsearch.common.collect.ImmutableMap; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; import java.lang.reflect.Constructor; -import static org.elasticsearch.util.MapBuilder.*; +import static org.elasticsearch.common.collect.MapBuilder.*; /** * A global registry of all different types of {@link org.elasticsearch.common.transport.TransportAddress} allowing diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/ConcurrentCollections.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/ConcurrentCollections.java similarity index 84% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/ConcurrentCollections.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/ConcurrentCollections.java index 55762648475..9ff8da6c961 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/ConcurrentCollections.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/ConcurrentCollections.java @@ -17,12 +17,12 @@ * under the License. */ -package org.elasticsearch.util.concurrent; +package org.elasticsearch.common.util.concurrent; -import org.elasticsearch.util.MapBackedSet; -import org.elasticsearch.util.concurrent.highscalelib.NonBlockingHashMap; -import org.elasticsearch.util.concurrent.highscalelib.NonBlockingHashMapLong; -import org.elasticsearch.util.concurrent.highscalelib.NonBlockingHashSet; +import org.elasticsearch.common.collect.MapBackedSet; +import org.elasticsearch.common.util.concurrent.highscalelib.NonBlockingHashMap; +import org.elasticsearch.common.util.concurrent.highscalelib.NonBlockingHashMapLong; +import org.elasticsearch.common.util.concurrent.highscalelib.NonBlockingHashSet; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/ConcurrentHashMapLong.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/ConcurrentHashMapLong.java similarity index 98% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/ConcurrentHashMapLong.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/ConcurrentHashMapLong.java index aa472a2d47e..a81f6c8ecc1 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/ConcurrentHashMapLong.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/ConcurrentHashMapLong.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.concurrent; +package org.elasticsearch.common.util.concurrent; import java.util.Collection; import java.util.Enumeration; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/ConcurrentIdentityHashMap.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/ConcurrentIdentityHashMap.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/ConcurrentIdentityHashMap.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/ConcurrentIdentityHashMap.java index 55001e86a2d..d551669d8cd 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/ConcurrentIdentityHashMap.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/ConcurrentIdentityHashMap.java @@ -17,9 +17,9 @@ * under the License. */ -package org.elasticsearch.util.concurrent; +package org.elasticsearch.common.util.concurrent; -import org.elasticsearch.util.ReusableIterator; +import org.elasticsearch.common.collect.ReusableIterator; import java.util.*; import java.util.concurrent.ConcurrentMap; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/ConcurrentMapLong.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/ConcurrentMapLong.java similarity index 95% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/ConcurrentMapLong.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/ConcurrentMapLong.java index d02b5758c90..f1d9de8c30e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/ConcurrentMapLong.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/ConcurrentMapLong.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.concurrent; +package org.elasticsearch.common.util.concurrent; import java.util.concurrent.ConcurrentMap; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/ConcurrentSafeArray.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/ConcurrentSafeArray.java similarity index 96% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/ConcurrentSafeArray.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/ConcurrentSafeArray.java index 7f598bcc87b..bdf10edebda 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/ConcurrentSafeArray.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/ConcurrentSafeArray.java @@ -17,9 +17,9 @@ * under the License. */ -package org.elasticsearch.util.concurrent; +package org.elasticsearch.common.util.concurrent; -import org.elasticsearch.util.SafeArray; +import org.elasticsearch.common.collect.SafeArray; import java.util.ArrayList; import java.util.concurrent.locks.ReadWriteLock; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/CopyOnWriteMap.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/CopyOnWriteMap.java similarity index 98% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/CopyOnWriteMap.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/CopyOnWriteMap.java index 80ec4f09eae..30d44b12a54 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/CopyOnWriteMap.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/CopyOnWriteMap.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.concurrent; +package org.elasticsearch.common.util.concurrent; import java.util.Collection; import java.util.HashMap; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/DynamicExecutors.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/DynamicExecutors.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/DynamicExecutors.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/DynamicExecutors.java index 9eb72f53568..313c2854d50 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/DynamicExecutors.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/DynamicExecutors.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.concurrent; +package org.elasticsearch.common.util.concurrent; import org.elasticsearch.common.settings.Settings; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/DynamicThreadPoolExecutor.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/DynamicThreadPoolExecutor.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/DynamicThreadPoolExecutor.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/DynamicThreadPoolExecutor.java index 268e0f3dc68..0e94618b924 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/DynamicThreadPoolExecutor.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/DynamicThreadPoolExecutor.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.concurrent; +package org.elasticsearch.common.util.concurrent; import java.util.concurrent.*; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/Immutable.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/Immutable.java similarity index 97% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/Immutable.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/Immutable.java index 35d1fd44198..d49e11d5186 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/Immutable.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/Immutable.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.concurrent; +package org.elasticsearch.common.util.concurrent; import java.lang.annotation.*; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/NotThreadSafe.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/NotThreadSafe.java similarity index 96% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/NotThreadSafe.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/NotThreadSafe.java index 64fd5625a26..46bb0b6fdf3 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/NotThreadSafe.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/NotThreadSafe.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.concurrent; +package org.elasticsearch.common.util.concurrent; import java.lang.annotation.*; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/ScalingThreadPoolExecutor.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/ScalingThreadPoolExecutor.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/ScalingThreadPoolExecutor.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/ScalingThreadPoolExecutor.java index bbb0ae4aae6..5e407f7d75b 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/ScalingThreadPoolExecutor.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/ScalingThreadPoolExecutor.java @@ -17,10 +17,10 @@ * under the License. */ -package org.elasticsearch.util.concurrent; +package org.elasticsearch.common.util.concurrent; +import org.elasticsearch.common.util.concurrent.jsr166y.LinkedTransferQueue; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.concurrent.jsr166y.LinkedTransferQueue; import java.util.*; import java.util.concurrent.*; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/ThreadBarrier.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/ThreadBarrier.java similarity index 91% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/ThreadBarrier.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/ThreadBarrier.java index 9544f54b84f..02546a06947 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/ThreadBarrier.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/ThreadBarrier.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.concurrent; +package org.elasticsearch.common.util.concurrent; import java.util.concurrent.BrokenBarrierException; import java.util.concurrent.CyclicBarrier; @@ -44,23 +44,23 @@ import java.util.concurrent.TimeoutException; * final ThreadBarrier barrier; *

* class Worker implements Runnable - * { + * { * public void run() - * { + * { * barrier.await(); //wait for all threads to reach run * try - * { + * { * prepare(); * barrier.await(); //wait for all threads to prepare * process(); * barrier.await(); //wait for all threads to process - * } + * } * catch(Throwable t){ * log("Worker thread caught exception", t); * barrier.reset(t); - * } - * } - * } + * } + * } + * } *

* public void testThreads() { * barrier = new ThreadBarrier(N_THREADS + 1); @@ -71,10 +71,10 @@ import java.util.concurrent.TimeoutException; * barrier.await(); //wait for all threads to reach run * barrier.await(); //wait for all threads to prepare * barrier.await(); //wait for all threads to process - * } + * } * catch(BrokenBarrierException bbe) { * Assert.fail(bbe); - * } + * } * } *

* int actualNotificationCount = 0; @@ -87,12 +87,12 @@ import java.util.concurrent.TimeoutException; * // too many notifications? * Assert.assertFalse("Exceeded notification count", * actualNotificationCount > EXPECTED_COUNT); - * } + * } * catch(Throwable t) { * log("Worker thread caught exception", t); * barrier.reset(t); - * } - * } + * } + * } *

* public void testNotify() { * barrier = new ThreadBarrier(N_LISTENERS + 1); @@ -109,7 +109,7 @@ import java.util.concurrent.TimeoutException; *

* //inspect that the barrier isn't broken * barrier.inspect(); //throws BrokenBarrierException if broken - * } + * } * } * * @@ -258,18 +258,18 @@ public class ThreadBarrier extends CyclicBarrier { *

* Usage example:
*


-     *                                                               BarrierTimer timer = new BarrierTimer();
-     *                                                               ThreadBarrier barrier = new ThreadBarrier( nTHREADS + 1, timer );
-     *                                                               ..
-     *                                                               barrier.await(); // starts timer when all threads trip on await
-     *                                                               barrier.await(); // stops  timer when all threads trip on await
-     *                                                               ..
-     *                                                               long time = timer.getTimeInNanos();
-     *                                                               long tpi = time / ((long)nREPEATS * nTHREADS); //throughput per thread iteration
-     *                                                               long secs = timer.getTimeInSeconds();	//total runtime in seconds
-     *                                                               ..
-     *                                                               timer.reset();  // reuse timer
-     *                                                             
+ * BarrierTimer timer = new BarrierTimer(); + * ThreadBarrier barrier = new ThreadBarrier( nTHREADS + 1, timer ); + * .. + * barrier.await(); // starts timer when all threads trip on await + * barrier.await(); // stops timer when all threads trip on await + * .. + * long time = timer.getTimeInNanos(); + * long tpi = time / ((long)nREPEATS * nTHREADS); //throughput per thread iteration + * long secs = timer.getTimeInSeconds(); //total runtime in seconds + * .. + * timer.reset(); // reuse timer + * */ public static class BarrierTimer implements Runnable { volatile boolean started; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/ThreadSafe.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/ThreadSafe.java similarity index 96% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/ThreadSafe.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/ThreadSafe.java index af549a94bd3..8d2b69d20f6 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/ThreadSafe.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/ThreadSafe.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.concurrent; +package org.elasticsearch.common.util.concurrent; import java.lang.annotation.*; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/UncategorizedExecutionException.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/UncategorizedExecutionException.java similarity index 95% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/UncategorizedExecutionException.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/UncategorizedExecutionException.java index eae532b8981..7818c8cc617 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/UncategorizedExecutionException.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/UncategorizedExecutionException.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.concurrent; +package org.elasticsearch.common.util.concurrent; import org.elasticsearch.ElasticSearchException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/AbstractEntry.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/AbstractEntry.java similarity index 97% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/AbstractEntry.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/AbstractEntry.java index 3a1e27c345d..5ee85dbb102 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/AbstractEntry.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/AbstractEntry.java @@ -22,7 +22,7 @@ * http://creativecommons.org/licenses/publicdomain */ -package org.elasticsearch.util.concurrent.highscalelib; +package org.elasticsearch.common.util.concurrent.highscalelib; import java.util.Map; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/ConcurrentAutoTable.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/ConcurrentAutoTable.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/ConcurrentAutoTable.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/ConcurrentAutoTable.java index f4900cd8905..b5e0c8bb8f7 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/ConcurrentAutoTable.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/ConcurrentAutoTable.java @@ -22,7 +22,7 @@ * http://creativecommons.org/licenses/publicdomain */ -package org.elasticsearch.util.concurrent.highscalelib; +package org.elasticsearch.common.util.concurrent.highscalelib; import sun.misc.Unsafe; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/Counter.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/Counter.java similarity index 97% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/Counter.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/Counter.java index 6a5f2265a14..a7ac1a2c5e8 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/Counter.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/Counter.java @@ -22,7 +22,7 @@ * http://creativecommons.org/licenses/publicdomain */ -package org.elasticsearch.util.concurrent.highscalelib; +package org.elasticsearch.common.util.concurrent.highscalelib; /** * A simple high-performance counter. Merely renames the extended {@link diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/NonBlockingHashMap.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/NonBlockingHashMap.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/NonBlockingHashMap.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/NonBlockingHashMap.java index 2c0aaf28e8d..21dee050edb 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/NonBlockingHashMap.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/NonBlockingHashMap.java @@ -22,7 +22,7 @@ * http://creativecommons.org/licenses/publicdomain */ -package org.elasticsearch.util.concurrent.highscalelib; +package org.elasticsearch.common.util.concurrent.highscalelib; import sun.misc.Unsafe; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/NonBlockingHashMapLong.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/NonBlockingHashMapLong.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/NonBlockingHashMapLong.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/NonBlockingHashMapLong.java index f921f3549a7..bfab0ebb0bd 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/NonBlockingHashMapLong.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/NonBlockingHashMapLong.java @@ -22,9 +22,9 @@ * http://creativecommons.org/licenses/publicdomain */ -package org.elasticsearch.util.concurrent.highscalelib; +package org.elasticsearch.common.util.concurrent.highscalelib; -import org.elasticsearch.util.concurrent.ConcurrentMapLong; +import org.elasticsearch.common.util.concurrent.ConcurrentMapLong; import sun.misc.Unsafe; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/NonBlockingHashSet.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/NonBlockingHashSet.java similarity index 98% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/NonBlockingHashSet.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/NonBlockingHashSet.java index a8fec6d5c37..68574d84fc6 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/NonBlockingHashSet.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/NonBlockingHashSet.java @@ -22,7 +22,7 @@ * http://creativecommons.org/licenses/publicdomain */ -package org.elasticsearch.util.concurrent.highscalelib; +package org.elasticsearch.common.util.concurrent.highscalelib; import java.io.Serializable; import java.util.AbstractSet; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/NonBlockingHashtable.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/NonBlockingHashtable.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/NonBlockingHashtable.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/NonBlockingHashtable.java index 6d7645661d9..03c7298e2b6 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/NonBlockingHashtable.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/NonBlockingHashtable.java @@ -23,7 +23,7 @@ */ /* WARNING: MACHINE GENERATED FILE! DO NOT EDIT!*/ -package org.elasticsearch.util.concurrent.highscalelib; +package org.elasticsearch.common.util.concurrent.highscalelib; import sun.misc.Unsafe; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/NonBlockingIdentityHashMap.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/NonBlockingIdentityHashMap.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/NonBlockingIdentityHashMap.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/NonBlockingIdentityHashMap.java index 4bc39652ad2..ff5fcffcdc6 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/NonBlockingIdentityHashMap.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/NonBlockingIdentityHashMap.java @@ -22,7 +22,7 @@ * http://creativecommons.org/licenses/publicdomain */ -package org.elasticsearch.util.concurrent.highscalelib; +package org.elasticsearch.common.util.concurrent.highscalelib; import sun.misc.Unsafe; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/NonBlockingSetInt.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/NonBlockingSetInt.java similarity index 99% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/NonBlockingSetInt.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/NonBlockingSetInt.java index 689ca4f84ed..8ccbf879c94 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/NonBlockingSetInt.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/NonBlockingSetInt.java @@ -22,7 +22,7 @@ * http://creativecommons.org/licenses/publicdomain */ -package org.elasticsearch.util.concurrent.highscalelib; +package org.elasticsearch.common.util.concurrent.highscalelib; import sun.misc.Unsafe; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/UtilUnsafe.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/UtilUnsafe.java similarity index 96% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/UtilUnsafe.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/UtilUnsafe.java index 4efc2e72e13..e87c7b4a499 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/UtilUnsafe.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/UtilUnsafe.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.util.concurrent.highscalelib; +package org.elasticsearch.common.util.concurrent.highscalelib; import sun.misc.Unsafe; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/package-info.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/package-info.java similarity index 93% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/package-info.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/package-info.java index eb90ba35d73..3d6a84d0294 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/highscalelib/package-info.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/highscalelib/package-info.java @@ -20,4 +20,4 @@ /** * A copy of Cliff High-Scale-Lib version 1.1.2. */ -package org.elasticsearch.util.concurrent.highscalelib; \ No newline at end of file +package org.elasticsearch.common.util.concurrent.highscalelib; \ No newline at end of file diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/resource/AcquirableResource.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/resource/AcquirableResource.java similarity index 93% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/resource/AcquirableResource.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/resource/AcquirableResource.java index 8f539f964b0..d8edf3bcbf2 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/resource/AcquirableResource.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/resource/AcquirableResource.java @@ -17,9 +17,9 @@ * under the License. */ -package org.elasticsearch.util.concurrent.resource; +package org.elasticsearch.common.util.concurrent.resource; -import org.elasticsearch.util.lease.Releasable; +import org.elasticsearch.common.lease.Releasable; /** * A wrapper around a resource that can be released. Note, release should not be diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/resource/AcquirableResourceFactory.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/resource/AcquirableResourceFactory.java similarity index 91% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/resource/AcquirableResourceFactory.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/resource/AcquirableResourceFactory.java index ab11db283fa..569a8267b02 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/resource/AcquirableResourceFactory.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/resource/AcquirableResourceFactory.java @@ -17,9 +17,9 @@ * under the License. */ -package org.elasticsearch.util.concurrent.resource; +package org.elasticsearch.common.util.concurrent.resource; -import org.elasticsearch.util.lease.Releasable; +import org.elasticsearch.common.lease.Releasable; /** * @author kimchy (Shay Banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/resource/BlockingAcquirableResource.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/resource/BlockingAcquirableResource.java similarity index 95% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/resource/BlockingAcquirableResource.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/resource/BlockingAcquirableResource.java index 0792bff3ca8..cfaab71b787 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/resource/BlockingAcquirableResource.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/resource/BlockingAcquirableResource.java @@ -17,9 +17,9 @@ * under the License. */ -package org.elasticsearch.util.concurrent.resource; +package org.elasticsearch.common.util.concurrent.resource; -import org.elasticsearch.util.lease.Releasable; +import org.elasticsearch.common.lease.Releasable; /** * A wrapper around a resource that can be released. Note, release should not be diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/resource/NonBlockingAcquirableResource.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/resource/NonBlockingAcquirableResource.java similarity index 96% rename from modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/resource/NonBlockingAcquirableResource.java rename to modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/resource/NonBlockingAcquirableResource.java index 51c03a21bf5..2465f101051 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/resource/NonBlockingAcquirableResource.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/util/concurrent/resource/NonBlockingAcquirableResource.java @@ -17,9 +17,9 @@ * under the License. */ -package org.elasticsearch.util.concurrent.resource; +package org.elasticsearch.common.util.concurrent.resource; -import org.elasticsearch.util.lease.Releasable; +import org.elasticsearch.common.lease.Releasable; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicStampedReference; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/builder/BinaryXContentBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/builder/BinaryXContentBuilder.java index 16e4a4fb422..a823b9524c4 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/builder/BinaryXContentBuilder.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/builder/BinaryXContentBuilder.java @@ -19,9 +19,9 @@ package org.elasticsearch.common.xcontent.builder; +import org.elasticsearch.common.io.FastByteArrayOutputStream; import org.elasticsearch.common.xcontent.XContent; import org.elasticsearch.util.Unicode; -import org.elasticsearch.util.io.FastByteArrayOutputStream; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/builder/TextXContentBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/builder/TextXContentBuilder.java index 190a70edd3d..af1c86a1c95 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/builder/TextXContentBuilder.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/builder/TextXContentBuilder.java @@ -20,9 +20,9 @@ package org.elasticsearch.common.xcontent.builder; import org.apache.lucene.util.UnicodeUtil; +import org.elasticsearch.common.io.FastCharArrayWriter; import org.elasticsearch.common.xcontent.XContent; import org.elasticsearch.util.Unicode; -import org.elasticsearch.util.io.FastCharArrayWriter; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/json/JsonXContent.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/json/JsonXContent.java index da2b89c48e3..dddccd72092 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/json/JsonXContent.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/json/JsonXContent.java @@ -20,6 +20,7 @@ package org.elasticsearch.common.xcontent.json; import org.elasticsearch.ElasticSearchException; +import org.elasticsearch.common.io.FastStringReader; import org.elasticsearch.common.jackson.JsonEncoding; import org.elasticsearch.common.jackson.JsonFactory; import org.elasticsearch.common.jackson.JsonGenerator; @@ -31,7 +32,6 @@ import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.builder.BinaryXContentBuilder; import org.elasticsearch.common.xcontent.builder.TextXContentBuilder; import org.elasticsearch.util.ThreadLocals; -import org.elasticsearch.util.io.FastStringReader; import java.io.*; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/xson/XsonXContent.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/xson/XsonXContent.java index 6ef9c417048..1539eeeb282 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/xson/XsonXContent.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/xson/XsonXContent.java @@ -21,13 +21,13 @@ package org.elasticsearch.common.xcontent.xson; import org.elasticsearch.ElasticSearchException; import org.elasticsearch.ElasticSearchIllegalStateException; +import org.elasticsearch.common.io.FastByteArrayInputStream; import org.elasticsearch.common.xcontent.XContent; import org.elasticsearch.common.xcontent.XContentGenerator; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.builder.BinaryXContentBuilder; import org.elasticsearch.util.ThreadLocals; -import org.elasticsearch.util.io.FastByteArrayInputStream; import java.io.*; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/local/LocalDiscovery.java b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/local/LocalDiscovery.java index 6122ee63108..ee8afa6685d 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/local/LocalDiscovery.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/local/LocalDiscovery.java @@ -27,10 +27,10 @@ import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.util.concurrent.jsr166y.LinkedTransferQueue; import org.elasticsearch.discovery.Discovery; import org.elasticsearch.discovery.InitialStateDiscoveryListener; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.util.concurrent.jsr166y.LinkedTransferQueue; import java.util.Queue; import java.util.Set; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/fd/MasterFaultDetection.java b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/fd/MasterFaultDetection.java index 952f113c808..5c2df997e5e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/fd/MasterFaultDetection.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/fd/MasterFaultDetection.java @@ -23,14 +23,14 @@ import org.elasticsearch.ElasticSearchIllegalStateException; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.component.AbstractComponent; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.discovery.zen.DiscoveryNodesProvider; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.*; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; import java.io.IOException; import java.util.concurrent.CopyOnWriteArrayList; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/fd/NodesFaultDetection.java b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/fd/NodesFaultDetection.java index 406bcf93fd1..7d0cff41a62 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/fd/NodesFaultDetection.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/fd/NodesFaultDetection.java @@ -23,21 +23,21 @@ import org.elasticsearch.ElasticSearchIllegalStateException; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.component.AbstractComponent; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.*; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; import java.io.IOException; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.CopyOnWriteArrayList; import static org.elasticsearch.cluster.node.DiscoveryNodes.*; +import static org.elasticsearch.common.util.concurrent.ConcurrentCollections.*; import static org.elasticsearch.util.TimeValue.*; -import static org.elasticsearch.util.concurrent.ConcurrentCollections.*; /** * A fault detection of multiple nodes. diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/membership/MembershipAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/membership/MembershipAction.java index d57295c68ee..739b390770c 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/membership/MembershipAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/membership/MembershipAction.java @@ -22,16 +22,16 @@ package org.elasticsearch.discovery.zen.membership; import org.elasticsearch.ElasticSearchException; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.component.AbstractComponent; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; +import org.elasticsearch.common.io.stream.VoidStreamable; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.transport.BaseTransportRequestHandler; import org.elasticsearch.transport.TransportChannel; import org.elasticsearch.transport.TransportService; import org.elasticsearch.transport.VoidTransportResponseHandler; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; -import org.elasticsearch.util.io.stream.VoidStreamable; import java.io.IOException; import java.util.concurrent.TimeUnit; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/ping/ZenPing.java b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/ping/ZenPing.java index 1b7aef974b4..a8f55a2e3ff 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/ping/ZenPing.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/ping/ZenPing.java @@ -23,11 +23,11 @@ import org.elasticsearch.ElasticSearchException; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.component.LifecycleComponent; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.discovery.zen.DiscoveryNodesProvider; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/ping/multicast/MulticastZenPing.java b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/ping/multicast/MulticastZenPing.java index 44c9acae77d..3e1b32b70d0 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/ping/multicast/MulticastZenPing.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/ping/multicast/MulticastZenPing.java @@ -25,6 +25,7 @@ import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.component.AbstractLifecycleComponent; +import org.elasticsearch.common.io.stream.*; import org.elasticsearch.common.network.NetworkService; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.discovery.DiscoveryException; @@ -34,7 +35,6 @@ import org.elasticsearch.discovery.zen.ping.ZenPingException; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.*; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.*; import java.io.IOException; import java.net.DatagramPacket; @@ -51,8 +51,8 @@ import java.util.concurrent.atomic.AtomicReference; import static org.elasticsearch.cluster.node.DiscoveryNode.*; import static org.elasticsearch.common.settings.ImmutableSettings.Builder.*; -import static org.elasticsearch.util.concurrent.ConcurrentCollections.*; -import static org.elasticsearch.util.concurrent.DynamicExecutors.*; +import static org.elasticsearch.common.util.concurrent.ConcurrentCollections.*; +import static org.elasticsearch.common.util.concurrent.DynamicExecutors.*; /** * @author kimchy (shay.banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/ping/unicast/UnicastZenPing.java b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/ping/unicast/UnicastZenPing.java index 5a3e4cec8ab..861a1d3a528 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/ping/unicast/UnicastZenPing.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/ping/unicast/UnicastZenPing.java @@ -26,18 +26,18 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.collect.Lists; import org.elasticsearch.common.component.AbstractLifecycleComponent; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.TransportAddress; +import org.elasticsearch.common.util.concurrent.jsr166y.LinkedTransferQueue; import org.elasticsearch.discovery.zen.DiscoveryNodesProvider; import org.elasticsearch.discovery.zen.ping.ZenPing; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.*; import org.elasticsearch.util.Strings; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.concurrent.jsr166y.LinkedTransferQueue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; import java.io.IOException; import java.util.List; @@ -49,9 +49,9 @@ import java.util.concurrent.atomic.AtomicReference; import static org.elasticsearch.common.collect.Lists.*; import static org.elasticsearch.common.settings.ImmutableSettings.Builder.*; +import static org.elasticsearch.common.util.concurrent.ConcurrentCollections.*; import static org.elasticsearch.discovery.zen.ping.ZenPing.PingResponse.*; import static org.elasticsearch.util.TimeValue.*; -import static org.elasticsearch.util.concurrent.ConcurrentCollections.*; /** * @author kimchy (shay.banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/publish/PublishClusterStateAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/publish/PublishClusterStateAction.java index bdbb6ab4f82..d001cfb4e57 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/publish/PublishClusterStateAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/publish/PublishClusterStateAction.java @@ -22,13 +22,13 @@ package org.elasticsearch.discovery.zen.publish; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.component.AbstractComponent; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; +import org.elasticsearch.common.io.stream.VoidStreamable; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.discovery.zen.DiscoveryNodesProvider; import org.elasticsearch.transport.*; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; -import org.elasticsearch.util.io.stream.VoidStreamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/env/Environment.java b/modules/elasticsearch/src/main/java/org/elasticsearch/env/Environment.java index 19ebc2424e3..5fba15a4e92 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/env/Environment.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/env/Environment.java @@ -20,9 +20,9 @@ package org.elasticsearch.env; import org.elasticsearch.cluster.ClusterName; +import org.elasticsearch.common.io.Streams; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.util.Classes; -import org.elasticsearch.util.io.Streams; import java.io.File; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/GatewayService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/GatewayService.java index 9494e5f0bf7..d3a3ee2043a 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/GatewayService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/GatewayService.java @@ -40,8 +40,8 @@ import java.util.concurrent.atomic.AtomicBoolean; import static java.util.concurrent.Executors.*; import static org.elasticsearch.cluster.ClusterState.*; import static org.elasticsearch.cluster.metadata.MetaData.*; +import static org.elasticsearch.common.util.concurrent.DynamicExecutors.*; import static org.elasticsearch.util.TimeValue.*; -import static org.elasticsearch.util.concurrent.DynamicExecutors.*; /** * @author kimchy (shay.banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/fs/FsGateway.java b/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/fs/FsGateway.java index 0dce7c7de06..58daa265f3c 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/fs/FsGateway.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/gateway/fs/FsGateway.java @@ -25,6 +25,7 @@ import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Module; +import org.elasticsearch.common.io.FileSystemUtils; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentFactory; @@ -35,11 +36,10 @@ import org.elasticsearch.env.Environment; import org.elasticsearch.gateway.Gateway; import org.elasticsearch.gateway.GatewayException; import org.elasticsearch.index.gateway.fs.FsIndexGatewayModule; -import org.elasticsearch.util.io.FileSystemUtils; import java.io.*; -import static org.elasticsearch.util.io.FileSystemUtils.*; +import static org.elasticsearch.common.io.FileSystemUtils.*; /** * @author kimchy (shay.banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/http/netty/NettyHttpServerTransport.java b/modules/elasticsearch/src/main/java/org/elasticsearch/http/netty/NettyHttpServerTransport.java index 7a4c0042485..229f34253bb 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/http/netty/NettyHttpServerTransport.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/http/netty/NettyHttpServerTransport.java @@ -52,7 +52,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicReference; import static org.elasticsearch.common.network.NetworkService.TcpSettings.*; -import static org.elasticsearch.util.concurrent.DynamicExecutors.*; +import static org.elasticsearch.common.util.concurrent.DynamicExecutors.*; /** * @author kimchy (shay.banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/Index.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/Index.java index ae77153d9c0..a9e9937f3bf 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/Index.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/Index.java @@ -19,10 +19,10 @@ package org.elasticsearch.index; -import org.elasticsearch.util.concurrent.Immutable; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; +import org.elasticsearch.common.util.concurrent.Immutable; import java.io.IOException; import java.io.Serializable; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/analysis/NamedAnalyzer.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/analysis/NamedAnalyzer.java index aa70ac38f4f..fe9f78d4778 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/analysis/NamedAnalyzer.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/analysis/NamedAnalyzer.java @@ -22,7 +22,7 @@ package org.elasticsearch.index.analysis; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.document.Fieldable; -import org.elasticsearch.util.concurrent.Immutable; +import org.elasticsearch.common.util.concurrent.Immutable; import java.io.IOException; import java.io.Reader; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/field/data/support/AbstractConcurrentMapFieldDataCache.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/field/data/support/AbstractConcurrentMapFieldDataCache.java index 09914d5d042..55f2f22c6af 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/field/data/support/AbstractConcurrentMapFieldDataCache.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/field/data/support/AbstractConcurrentMapFieldDataCache.java @@ -22,13 +22,13 @@ package org.elasticsearch.index.cache.field.data.support; import org.apache.lucene.index.IndexReader; import org.elasticsearch.ElasticSearchException; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.util.concurrent.ConcurrentCollections; import org.elasticsearch.index.AbstractIndexComponent; import org.elasticsearch.index.Index; import org.elasticsearch.index.cache.field.data.FieldDataCache; import org.elasticsearch.index.field.data.FieldData; import org.elasticsearch.index.field.data.FieldDataOptions; import org.elasticsearch.index.settings.IndexSettings; -import org.elasticsearch.util.concurrent.ConcurrentCollections; import java.io.IOException; import java.util.concurrent.ConcurrentMap; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/filter/support/AbstractConcurrentMapFilterCache.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/filter/support/AbstractConcurrentMapFilterCache.java index e36816c299f..21d358b0141 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/filter/support/AbstractConcurrentMapFilterCache.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/filter/support/AbstractConcurrentMapFilterCache.java @@ -33,7 +33,7 @@ import java.io.IOException; import java.util.concurrent.ConcurrentMap; import static org.elasticsearch.common.lucene.docset.DocSets.*; -import static org.elasticsearch.util.concurrent.ConcurrentCollections.*; +import static org.elasticsearch.common.util.concurrent.ConcurrentCollections.*; /** * A base concurrent filter cache that accepts the actual cache to use. diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/deletionpolicy/SnapshotIndexCommit.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/deletionpolicy/SnapshotIndexCommit.java index 09ad54c79e4..9a286f102c9 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/deletionpolicy/SnapshotIndexCommit.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/deletionpolicy/SnapshotIndexCommit.java @@ -20,8 +20,8 @@ package org.elasticsearch.index.deletionpolicy; import org.apache.lucene.index.IndexCommit; +import org.elasticsearch.common.lease.Releasable; import org.elasticsearch.common.lucene.IndexCommitDelegate; -import org.elasticsearch.util.lease.Releasable; import java.io.IOException; import java.util.ArrayList; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/deletionpolicy/SnapshotIndexCommits.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/deletionpolicy/SnapshotIndexCommits.java index d2598a12ad6..e136cdf1671 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/deletionpolicy/SnapshotIndexCommits.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/deletionpolicy/SnapshotIndexCommits.java @@ -19,7 +19,7 @@ package org.elasticsearch.index.deletionpolicy; -import org.elasticsearch.util.lease.Releasable; +import org.elasticsearch.common.lease.Releasable; import java.util.Iterator; import java.util.List; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/engine/Engine.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/engine/Engine.java index 3f54cb1768d..da855877f56 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/engine/Engine.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/engine/Engine.java @@ -27,12 +27,12 @@ import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Query; import org.elasticsearch.ElasticSearchException; import org.elasticsearch.common.component.CloseableComponent; +import org.elasticsearch.common.lease.Releasable; +import org.elasticsearch.common.util.concurrent.ThreadSafe; import org.elasticsearch.index.deletionpolicy.SnapshotIndexCommit; import org.elasticsearch.index.shard.IndexShardComponent; import org.elasticsearch.index.translog.Translog; import org.elasticsearch.util.SizeValue; -import org.elasticsearch.util.concurrent.ThreadSafe; -import org.elasticsearch.util.lease.Releasable; import javax.annotation.Nullable; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/engine/robin/RobinEngine.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/engine/robin/RobinEngine.java index cad8c4fbe15..2c2fcbc8e8f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/engine/robin/RobinEngine.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/engine/robin/RobinEngine.java @@ -28,6 +28,7 @@ import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.lucene.IndexWriters; import org.elasticsearch.common.lucene.ReaderSearcherHolder; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.util.concurrent.resource.AcquirableResource; import org.elasticsearch.index.analysis.AnalysisService; import org.elasticsearch.index.deletionpolicy.SnapshotDeletionPolicy; import org.elasticsearch.index.deletionpolicy.SnapshotIndexCommit; @@ -44,7 +45,6 @@ import org.elasticsearch.util.Preconditions; import org.elasticsearch.util.SizeUnit; import org.elasticsearch.util.SizeValue; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.concurrent.resource.AcquirableResource; import java.io.IOException; import java.util.concurrent.atomic.AtomicBoolean; @@ -52,8 +52,8 @@ import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; import static org.elasticsearch.common.lucene.Lucene.*; +import static org.elasticsearch.common.util.concurrent.resource.AcquirableResourceFactory.*; import static org.elasticsearch.util.TimeValue.*; -import static org.elasticsearch.util.concurrent.resource.AcquirableResourceFactory.*; /** * @author kimchy (shay.banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/fs/FsIndexGateway.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/fs/FsIndexGateway.java index 6dd73d23347..131420ecca4 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/fs/FsIndexGateway.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/fs/FsIndexGateway.java @@ -34,7 +34,7 @@ import org.elasticsearch.util.Strings; import java.io.File; -import static org.elasticsearch.util.io.FileSystemUtils.*; +import static org.elasticsearch.common.io.FileSystemUtils.*; /** * @author kimchy (Shay Banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/fs/FsIndexShardGateway.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/fs/FsIndexShardGateway.java index 4438b30f229..68912fc922d 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/fs/FsIndexShardGateway.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/fs/FsIndexShardGateway.java @@ -23,6 +23,9 @@ import org.apache.lucene.index.IndexReader; import org.apache.lucene.store.IndexInput; import org.elasticsearch.common.collect.Lists; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.DataInputStreamInput; +import org.elasticsearch.common.io.stream.DataOutputStreamOutput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.deletionpolicy.SnapshotIndexCommit; import org.elasticsearch.index.gateway.IndexGateway; @@ -41,9 +44,6 @@ import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.util.SizeUnit; import org.elasticsearch.util.SizeValue; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.DataInputStreamInput; -import org.elasticsearch.util.io.stream.DataOutputStreamOutput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.File; import java.io.FilenameFilter; @@ -54,9 +54,9 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; +import static org.elasticsearch.common.io.FileSystemUtils.*; import static org.elasticsearch.common.lucene.Directories.*; import static org.elasticsearch.index.translog.TranslogStreams.*; -import static org.elasticsearch.util.io.FileSystemUtils.*; /** * @author kimchy (Shay Banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/DocumentFieldMappers.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/DocumentFieldMappers.java index 8de77daaaee..b8eaaab8673 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/DocumentFieldMappers.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/DocumentFieldMappers.java @@ -24,8 +24,8 @@ import org.elasticsearch.common.collect.ImmutableList; import org.elasticsearch.common.collect.ImmutableMap; import org.elasticsearch.common.collect.Iterables; import org.elasticsearch.common.collect.UnmodifiableIterator; +import org.elasticsearch.common.util.concurrent.Immutable; import org.elasticsearch.index.analysis.FieldNameAnalyzer; -import org.elasticsearch.util.concurrent.Immutable; import java.util.Map; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/DocumentMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/DocumentMapper.java index 8f7c54d4752..cb9069f0b18 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/DocumentMapper.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/DocumentMapper.java @@ -21,7 +21,7 @@ package org.elasticsearch.index.mapper; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.document.Fieldable; -import org.elasticsearch.util.concurrent.ThreadSafe; +import org.elasticsearch.common.util.concurrent.ThreadSafe; import javax.annotation.Nullable; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/FieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/FieldMapper.java index a59957d019b..d1616fbcf85 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/FieldMapper.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/FieldMapper.java @@ -25,9 +25,9 @@ import org.apache.lucene.document.Fieldable; import org.apache.lucene.index.Term; import org.apache.lucene.search.Filter; import org.apache.lucene.search.Query; +import org.elasticsearch.common.util.concurrent.Immutable; +import org.elasticsearch.common.util.concurrent.ThreadSafe; import org.elasticsearch.index.field.data.FieldData; -import org.elasticsearch.util.concurrent.Immutable; -import org.elasticsearch.util.concurrent.ThreadSafe; /** * @author kimchy (Shay Banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/FieldMappers.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/FieldMappers.java index 2768f16a1b4..d604f58ee78 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/FieldMappers.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/FieldMappers.java @@ -22,7 +22,7 @@ package org.elasticsearch.index.mapper; import org.elasticsearch.common.collect.ImmutableList; import org.elasticsearch.common.collect.Iterators; import org.elasticsearch.common.collect.UnmodifiableIterator; -import org.elasticsearch.util.concurrent.Immutable; +import org.elasticsearch.common.util.concurrent.Immutable; /** * A holder for several {@link FieldMapper}. diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/MapperService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/MapperService.java index b5b686d93f1..c84e2cf5668 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/MapperService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/MapperService.java @@ -24,7 +24,9 @@ import org.apache.lucene.analysis.TokenStream; import org.elasticsearch.common.collect.ImmutableMap; import org.elasticsearch.common.collect.UnmodifiableIterator; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.Streams; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.util.concurrent.ThreadSafe; import org.elasticsearch.env.Environment; import org.elasticsearch.env.FailedToResolveConfigException; import org.elasticsearch.index.AbstractIndexComponent; @@ -32,8 +34,6 @@ import org.elasticsearch.index.Index; import org.elasticsearch.index.analysis.AnalysisService; import org.elasticsearch.index.mapper.xcontent.XContentDocumentMapperParser; import org.elasticsearch.index.settings.IndexSettings; -import org.elasticsearch.util.concurrent.ThreadSafe; -import org.elasticsearch.util.io.Streams; import javax.annotation.Nullable; import java.io.File; @@ -43,7 +43,7 @@ import java.io.Reader; import java.net.MalformedURLException; import java.net.URL; -import static org.elasticsearch.util.MapBuilder.*; +import static org.elasticsearch.common.collect.MapBuilder.*; /** * @author kimchy (Shay Banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/SourceFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/SourceFieldMapper.java index 63c86c75cb5..3dca6bb3e24 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/SourceFieldMapper.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/SourceFieldMapper.java @@ -21,7 +21,7 @@ package org.elasticsearch.index.mapper; import org.apache.lucene.document.Document; import org.apache.lucene.document.FieldSelector; -import org.elasticsearch.util.concurrent.ThreadSafe; +import org.elasticsearch.common.util.concurrent.ThreadSafe; /** * A mapper that maps the actual source of a generated document. diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/TypeFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/TypeFieldMapper.java index 90904cb27db..52857201a75 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/TypeFieldMapper.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/TypeFieldMapper.java @@ -21,7 +21,7 @@ package org.elasticsearch.index.mapper; import org.apache.lucene.document.Document; import org.apache.lucene.index.Term; -import org.elasticsearch.util.concurrent.ThreadSafe; +import org.elasticsearch.common.util.concurrent.ThreadSafe; /** * A mapper that maps the type of the resource into the document. diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/UidFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/UidFieldMapper.java index 91d929db741..a2f101ec15d 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/UidFieldMapper.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/UidFieldMapper.java @@ -20,7 +20,7 @@ package org.elasticsearch.index.mapper; import org.apache.lucene.index.Term; -import org.elasticsearch.util.concurrent.ThreadSafe; +import org.elasticsearch.common.util.concurrent.ThreadSafe; /** * @author kimchy (Shay Banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/ContentPath.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/ContentPath.java index a42010833ca..d0ece590844 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/ContentPath.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/ContentPath.java @@ -19,7 +19,7 @@ package org.elasticsearch.index.mapper.xcontent; -import org.elasticsearch.util.concurrent.NotThreadSafe; +import org.elasticsearch.common.util.concurrent.NotThreadSafe; /** * @author kimchy (Shay Banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/ParseContext.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/ParseContext.java index a18a7f39722..ffa87810637 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/ParseContext.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/ParseContext.java @@ -21,9 +21,9 @@ package org.elasticsearch.index.mapper.xcontent; import org.apache.lucene.document.Document; import org.elasticsearch.common.lucene.all.AllEntries; +import org.elasticsearch.common.util.concurrent.NotThreadSafe; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.index.mapper.DocumentMapper; -import org.elasticsearch.util.concurrent.NotThreadSafe; /** * @author kimchy (Shay Banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentDocumentMapperParser.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentDocumentMapperParser.java index 3ba543cc8f2..6eac82dc153 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentDocumentMapperParser.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentDocumentMapperParser.java @@ -20,13 +20,13 @@ package org.elasticsearch.index.mapper.xcontent; import org.elasticsearch.common.collect.ImmutableMap; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.index.analysis.AnalysisService; import org.elasticsearch.index.mapper.DocumentMapper; import org.elasticsearch.index.mapper.DocumentMapperParser; import org.elasticsearch.index.mapper.MapperParsingException; -import org.elasticsearch.util.MapBuilder; import org.elasticsearch.util.Strings; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentMapper.java index e1054ff9ab7..f65d9d5edd7 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentMapper.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentMapper.java @@ -19,11 +19,11 @@ package org.elasticsearch.index.mapper.xcontent; +import org.elasticsearch.common.util.concurrent.NotThreadSafe; +import org.elasticsearch.common.util.concurrent.ThreadSafe; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.index.mapper.FieldMapperListener; import org.elasticsearch.index.mapper.MergeMappingException; -import org.elasticsearch.util.concurrent.NotThreadSafe; -import org.elasticsearch.util.concurrent.ThreadSafe; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentMultiFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentMultiFieldMapper.java index 6baacf2214a..6da47f56e41 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentMultiFieldMapper.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentMultiFieldMapper.java @@ -33,9 +33,9 @@ import java.util.List; import java.util.Map; import static org.elasticsearch.common.collect.Lists.*; +import static org.elasticsearch.common.collect.MapBuilder.*; import static org.elasticsearch.index.mapper.xcontent.XContentMapperBuilders.*; import static org.elasticsearch.index.mapper.xcontent.XContentTypeParsers.*; -import static org.elasticsearch.util.MapBuilder.*; /** * @author kimchy (shay.banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentObjectMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentObjectMapper.java index 5d3077061b8..5f8f760f54b 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentObjectMapper.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentObjectMapper.java @@ -23,11 +23,11 @@ import org.elasticsearch.ElasticSearchIllegalStateException; import org.elasticsearch.common.collect.ImmutableMap; import org.elasticsearch.common.joda.FormatDateTimeFormatter; import org.elasticsearch.common.joda.Joda; +import org.elasticsearch.common.util.concurrent.ThreadSafe; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.builder.XContentBuilder; import org.elasticsearch.index.mapper.*; import org.elasticsearch.util.Strings; -import org.elasticsearch.util.concurrent.ThreadSafe; import java.io.IOException; import java.util.HashMap; @@ -36,10 +36,10 @@ import java.util.Map; import static org.elasticsearch.common.collect.ImmutableMap.*; import static org.elasticsearch.common.collect.Lists.*; +import static org.elasticsearch.common.collect.MapBuilder.*; import static org.elasticsearch.common.xcontent.support.XContentMapValues.*; import static org.elasticsearch.index.mapper.xcontent.XContentMapperBuilders.*; import static org.elasticsearch.index.mapper.xcontent.XContentTypeParsers.*; -import static org.elasticsearch.util.MapBuilder.*; /** * @author kimchy (shay.banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/QueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/QueryBuilder.java index 0369b4b5172..ea32766060e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/QueryBuilder.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/QueryBuilder.java @@ -19,8 +19,8 @@ package org.elasticsearch.index.query; +import org.elasticsearch.common.io.FastByteArrayOutputStream; import org.elasticsearch.common.xcontent.XContentType; -import org.elasticsearch.util.io.FastByteArrayOutputStream; /** * @author kimchy (shay.banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/BaseQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/BaseQueryBuilder.java index b80865833fb..776bdc0fdea 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/BaseQueryBuilder.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/BaseQueryBuilder.java @@ -19,12 +19,12 @@ package org.elasticsearch.index.query.xcontent; +import org.elasticsearch.common.io.FastByteArrayOutputStream; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.builder.BinaryXContentBuilder; import org.elasticsearch.common.xcontent.builder.XContentBuilder; import org.elasticsearch.index.query.QueryBuilderException; -import org.elasticsearch.util.io.FastByteArrayOutputStream; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/XContentIndexQueryParser.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/XContentIndexQueryParser.java index 3f269a4d0ee..ee15bf8e4b8 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/XContentIndexQueryParser.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/XContentIndexQueryParser.java @@ -24,6 +24,7 @@ import org.apache.lucene.search.Query; import org.elasticsearch.ElasticSearchException; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.assistedinject.Assisted; +import org.elasticsearch.common.io.FastByteArrayOutputStream; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; @@ -40,7 +41,6 @@ import org.elasticsearch.index.settings.IndexSettings; import org.elasticsearch.index.similarity.SimilarityService; import org.elasticsearch.script.ScriptService; import org.elasticsearch.util.ThreadLocals; -import org.elasticsearch.util.io.FastByteArrayOutputStream; import javax.annotation.Nullable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/routing/plain/PlainOperationRouting.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/routing/plain/PlainOperationRouting.java index 44dcdc89102..5aef8e1a963 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/routing/plain/PlainOperationRouting.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/routing/plain/PlainOperationRouting.java @@ -25,6 +25,7 @@ import org.elasticsearch.cluster.routing.GroupShardsIterator; import org.elasticsearch.cluster.routing.IndexRoutingTable; import org.elasticsearch.cluster.routing.IndexShardRoutingTable; import org.elasticsearch.cluster.routing.ShardsIterator; +import org.elasticsearch.common.collect.IdentityHashSet; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.AbstractIndexComponent; @@ -35,7 +36,6 @@ import org.elasticsearch.index.routing.hash.HashFunction; import org.elasticsearch.index.settings.IndexSettings; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.indices.IndexMissingException; -import org.elasticsearch.util.IdentityHashSet; import javax.annotation.Nullable; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/service/InternalIndexService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/service/InternalIndexService.java index a889b6bcb3c..281fb220318 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/service/InternalIndexService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/service/InternalIndexService.java @@ -66,9 +66,9 @@ import java.util.List; import java.util.Map; import java.util.Set; +import static org.elasticsearch.common.collect.MapBuilder.*; import static org.elasticsearch.common.collect.Maps.*; import static org.elasticsearch.common.collect.Sets.*; -import static org.elasticsearch.util.MapBuilder.*; /** * @author kimchy (shay.banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/ShardId.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/ShardId.java index 8508669cb76..0ccf6c02264 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/ShardId.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/ShardId.java @@ -19,11 +19,11 @@ package org.elasticsearch.index.shard; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; +import org.elasticsearch.common.util.concurrent.Immutable; import org.elasticsearch.index.Index; -import org.elasticsearch.util.concurrent.Immutable; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; import java.io.IOException; import java.io.Serializable; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoveryAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoveryAction.java index 6d6eb688439..5880b871bb7 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoveryAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoveryAction.java @@ -27,6 +27,10 @@ import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.component.CloseableComponent; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; +import org.elasticsearch.common.io.stream.VoidStreamable; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.deletionpolicy.SnapshotIndexCommit; import org.elasticsearch.index.engine.Engine; @@ -44,10 +48,6 @@ import org.elasticsearch.transport.*; import org.elasticsearch.util.SizeUnit; import org.elasticsearch.util.SizeValue; import org.elasticsearch.util.StopWatch; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; -import org.elasticsearch.util.io.stream.VoidStreamable; import java.io.IOException; import java.util.ArrayList; @@ -60,8 +60,8 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; import static java.util.concurrent.TimeUnit.*; +import static org.elasticsearch.common.util.concurrent.ConcurrentCollections.*; import static org.elasticsearch.util.TimeValue.*; -import static org.elasticsearch.util.concurrent.ConcurrentCollections.*; /** * @author kimchy (shay.banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/service/IndexShard.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/service/IndexShard.java index 48b3af09d84..8b3b29b0a43 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/service/IndexShard.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/service/IndexShard.java @@ -23,13 +23,13 @@ import org.apache.lucene.index.Term; import org.elasticsearch.ElasticSearchException; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.common.component.CloseableComponent; +import org.elasticsearch.common.util.concurrent.ThreadSafe; import org.elasticsearch.index.engine.Engine; import org.elasticsearch.index.engine.EngineException; import org.elasticsearch.index.mapper.ParsedDocument; import org.elasticsearch.index.shard.IndexShardComponent; import org.elasticsearch.index.shard.IndexShardState; import org.elasticsearch.util.SizeValue; -import org.elasticsearch.util.concurrent.ThreadSafe; import javax.annotation.Nullable; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/service/InternalIndexShard.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/service/InternalIndexShard.java index 91d00299f6c..f727b9bcfe7 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/service/InternalIndexShard.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/service/InternalIndexShard.java @@ -31,6 +31,7 @@ import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.common.lucene.search.TermFilter; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.util.concurrent.ThreadSafe; import org.elasticsearch.index.cache.IndexCache; import org.elasticsearch.index.engine.Engine; import org.elasticsearch.index.engine.EngineException; @@ -52,7 +53,6 @@ import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.util.SizeValue; import org.elasticsearch.util.Strings; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.concurrent.ThreadSafe; import javax.annotation.Nullable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/store/fs/AbstractFsStore.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/store/fs/AbstractFsStore.java index 003fdcfa596..93cc2e94aff 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/store/fs/AbstractFsStore.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/store/fs/AbstractFsStore.java @@ -22,6 +22,7 @@ package org.elasticsearch.index.store.fs; import org.apache.lucene.store.Directory; import org.apache.lucene.store.FSDirectory; import org.elasticsearch.common.collect.ImmutableSet; +import org.elasticsearch.common.io.FileSystemUtils; import org.elasticsearch.common.lucene.store.SwitchDirectory; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.settings.IndexSettings; @@ -31,7 +32,6 @@ import org.elasticsearch.index.store.memory.HeapDirectory; import org.elasticsearch.index.store.support.AbstractStore; import org.elasticsearch.util.SizeUnit; import org.elasticsearch.util.SizeValue; -import org.elasticsearch.util.io.FileSystemUtils; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/store/memory/HeapDirectory.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/store/memory/HeapDirectory.java index e5ce40e441a..e296e91c8d6 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/store/memory/HeapDirectory.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/store/memory/HeapDirectory.java @@ -32,7 +32,7 @@ import java.util.Map; import java.util.Queue; import java.util.concurrent.ArrayBlockingQueue; -import static org.elasticsearch.util.concurrent.ConcurrentCollections.*; +import static org.elasticsearch.common.util.concurrent.ConcurrentCollections.*; /** * @author kimchy (Shay Banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/translog/Translog.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/translog/Translog.java index 4159f737735..37b6fbbdedc 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/translog/Translog.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/translog/Translog.java @@ -21,17 +21,17 @@ package org.elasticsearch.index.translog; import org.apache.lucene.index.Term; import org.elasticsearch.ElasticSearchException; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; +import org.elasticsearch.common.lease.Releasable; +import org.elasticsearch.common.util.concurrent.NotThreadSafe; +import org.elasticsearch.common.util.concurrent.ThreadSafe; import org.elasticsearch.index.engine.Engine; import org.elasticsearch.index.shard.IndexShardComponent; import org.elasticsearch.index.shard.service.IndexShard; import org.elasticsearch.util.SizeValue; import org.elasticsearch.util.Strings; -import org.elasticsearch.util.concurrent.NotThreadSafe; -import org.elasticsearch.util.concurrent.ThreadSafe; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; -import org.elasticsearch.util.lease.Releasable; import javax.annotation.Nullable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/translog/TranslogStreams.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/translog/TranslogStreams.java index a731ddffbdb..179ea855e03 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/translog/TranslogStreams.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/translog/TranslogStreams.java @@ -19,8 +19,8 @@ package org.elasticsearch.index.translog; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/translog/memory/MemorySnapshot.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/translog/memory/MemorySnapshot.java index b10a5c0fb29..9ef333743c0 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/translog/memory/MemorySnapshot.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/translog/memory/MemorySnapshot.java @@ -22,9 +22,9 @@ package org.elasticsearch.index.translog.memory; import org.elasticsearch.ElasticSearchException; import org.elasticsearch.ElasticSearchIllegalArgumentException; import org.elasticsearch.common.collect.Iterables; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.index.translog.Translog; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; import java.util.Arrays; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/translog/memory/MemoryTranslog.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/translog/memory/MemoryTranslog.java index 46b6fc0ea99..410d27dde84 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/translog/memory/MemoryTranslog.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/translog/memory/MemoryTranslog.java @@ -21,6 +21,8 @@ package org.elasticsearch.index.translog.memory; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.util.concurrent.ThreadSafe; +import org.elasticsearch.common.util.concurrent.jsr166y.LinkedTransferQueue; import org.elasticsearch.index.settings.IndexSettings; import org.elasticsearch.index.shard.AbstractIndexShardComponent; import org.elasticsearch.index.shard.ShardId; @@ -28,8 +30,6 @@ import org.elasticsearch.index.translog.Translog; import org.elasticsearch.index.translog.TranslogException; import org.elasticsearch.util.SizeUnit; import org.elasticsearch.util.SizeValue; -import org.elasticsearch.util.concurrent.ThreadSafe; -import org.elasticsearch.util.concurrent.jsr166y.LinkedTransferQueue; import java.util.ArrayList; import java.util.Queue; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/indices/IndicesMemoryCleaner.java b/modules/elasticsearch/src/main/java/org/elasticsearch/indices/IndicesMemoryCleaner.java index b4661a49195..bb4edb020ba 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/indices/IndicesMemoryCleaner.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/indices/IndicesMemoryCleaner.java @@ -19,6 +19,7 @@ package org.elasticsearch.indices; +import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; @@ -33,7 +34,6 @@ import org.elasticsearch.index.shard.service.InternalIndexShard; import org.elasticsearch.index.translog.Translog; import org.elasticsearch.util.SizeUnit; import org.elasticsearch.util.SizeValue; -import org.elasticsearch.util.Tuple; import java.util.ArrayList; import java.util.Collections; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/indices/IndicesService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/indices/IndicesService.java index e5d778ab3e3..94f9b5ba6e5 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/indices/IndicesService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/indices/IndicesService.java @@ -24,8 +24,8 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.routing.GroupShardsIterator; import org.elasticsearch.common.component.LifecycleComponent; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.util.concurrent.ThreadSafe; import org.elasticsearch.index.service.IndexService; -import org.elasticsearch.util.concurrent.ThreadSafe; import java.util.Set; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/indices/InternalIndicesService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/indices/InternalIndicesService.java index ac35174c783..da4beb31e55 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/indices/InternalIndicesService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/indices/InternalIndicesService.java @@ -31,6 +31,7 @@ import org.elasticsearch.common.inject.Injector; import org.elasticsearch.common.inject.Injectors; import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.util.concurrent.ThreadSafe; import org.elasticsearch.gateway.Gateway; import org.elasticsearch.index.*; import org.elasticsearch.index.analysis.AnalysisModule; @@ -51,7 +52,6 @@ import org.elasticsearch.indices.analysis.IndicesAnalysisService; import org.elasticsearch.indices.cluster.IndicesClusterStateService; import org.elasticsearch.plugins.IndicesPluginsModule; import org.elasticsearch.plugins.PluginsService; -import org.elasticsearch.util.concurrent.ThreadSafe; import java.util.ArrayList; import java.util.HashMap; @@ -59,10 +59,10 @@ import java.util.Map; import java.util.Set; import static org.elasticsearch.cluster.metadata.IndexMetaData.*; +import static org.elasticsearch.common.collect.MapBuilder.*; import static org.elasticsearch.common.collect.Maps.*; import static org.elasticsearch.common.collect.Sets.*; import static org.elasticsearch.common.settings.ImmutableSettings.*; -import static org.elasticsearch.util.MapBuilder.*; /** * @author kimchy (shay.banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/indices/analysis/IndicesAnalysisService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/indices/analysis/IndicesAnalysisService.java index 4203e7036cb..cb90505d672 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/indices/analysis/IndicesAnalysisService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/indices/analysis/IndicesAnalysisService.java @@ -36,9 +36,9 @@ import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.util.concurrent.ConcurrentCollections; import org.elasticsearch.index.analysis.AnalyzerScope; import org.elasticsearch.index.analysis.PreBuiltAnalyzerProviderFactory; -import org.elasticsearch.util.concurrent.ConcurrentCollections; import java.util.Map; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/jmx/JmxClusterService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/jmx/JmxClusterService.java index 1076cd241a1..45cd6f73ceb 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/jmx/JmxClusterService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/jmx/JmxClusterService.java @@ -34,7 +34,7 @@ import javax.management.remote.JMXServiceURL; import java.util.concurrent.ExecutorService; import static java.util.concurrent.Executors.*; -import static org.elasticsearch.util.concurrent.DynamicExecutors.*; +import static org.elasticsearch.common.util.concurrent.DynamicExecutors.*; /** * @author kimchy (Shay Banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/jmx/ResourceDMBean.java b/modules/elasticsearch/src/main/java/org/elasticsearch/jmx/ResourceDMBean.java index 4b40f02a487..5f6e444ec63 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/jmx/ResourceDMBean.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/jmx/ResourceDMBean.java @@ -21,9 +21,9 @@ package org.elasticsearch.jmx; import org.elasticsearch.common.collect.ImmutableList; import org.elasticsearch.common.collect.ImmutableMap; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.util.Classes; -import org.elasticsearch.util.MapBuilder; import org.elasticsearch.util.Preconditions; import org.elasticsearch.util.Strings; @@ -37,7 +37,7 @@ import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; -import static org.elasticsearch.util.MapBuilder.*; +import static org.elasticsearch.common.collect.MapBuilder.*; /** * @author kimchy (Shay Banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/jmx/action/GetJmxServiceUrlAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/jmx/action/GetJmxServiceUrlAction.java index d65c12abcf4..1c36a409010 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/jmx/action/GetJmxServiceUrlAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/jmx/action/GetJmxServiceUrlAction.java @@ -24,14 +24,14 @@ import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StringStreamable; +import org.elasticsearch.common.io.stream.VoidStreamable; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.jmx.JmxService; import org.elasticsearch.transport.BaseTransportRequestHandler; import org.elasticsearch.transport.FutureTransportResponseHandler; import org.elasticsearch.transport.TransportChannel; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.util.io.stream.StringStreamable; -import org.elasticsearch.util.io.stream.VoidStreamable; /** * @author kimchy (Shay Banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java index 8de2c0fdb88..3720d8aa528 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java @@ -19,11 +19,11 @@ package org.elasticsearch.monitor.jvm; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.builder.XContentBuilder; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; import java.io.IOException; import java.io.Serializable; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/jvm/JvmStats.java b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/jvm/JvmStats.java index 8f0eda021d0..c8e1999eeff 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/jvm/JvmStats.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/jvm/JvmStats.java @@ -20,13 +20,13 @@ package org.elasticsearch.monitor.jvm; import org.elasticsearch.common.collect.Iterators; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.builder.XContentBuilder; import org.elasticsearch.util.SizeValue; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; import java.io.IOException; import java.io.Serializable; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/network/NetworkInfo.java b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/network/NetworkInfo.java index 7bffc0ef1d1..c5a294be0b3 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/network/NetworkInfo.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/network/NetworkInfo.java @@ -19,11 +19,11 @@ package org.elasticsearch.monitor.network; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.builder.XContentBuilder; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; import java.io.IOException; import java.io.Serializable; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/network/NetworkStats.java b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/network/NetworkStats.java index f9fd238ed18..ba5aa609158 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/network/NetworkStats.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/network/NetworkStats.java @@ -19,11 +19,11 @@ package org.elasticsearch.monitor.network; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.builder.XContentBuilder; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; import java.io.IOException; import java.io.Serializable; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/os/OsInfo.java b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/os/OsInfo.java index 2edc5066f1e..0260b3335a2 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/os/OsInfo.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/os/OsInfo.java @@ -19,12 +19,12 @@ package org.elasticsearch.monitor.os; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.builder.XContentBuilder; import org.elasticsearch.util.SizeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; import java.io.IOException; import java.io.Serializable; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/os/OsStats.java b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/os/OsStats.java index c1fd3d1a79d..492ba629692 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/os/OsStats.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/os/OsStats.java @@ -19,13 +19,13 @@ package org.elasticsearch.monitor.os; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.builder.XContentBuilder; import org.elasticsearch.util.SizeValue; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; import java.io.IOException; import java.io.Serializable; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/process/ProcessInfo.java b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/process/ProcessInfo.java index 4c51b3fddd0..171bef5c130 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/process/ProcessInfo.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/process/ProcessInfo.java @@ -19,11 +19,11 @@ package org.elasticsearch.monitor.process; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.builder.XContentBuilder; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; import java.io.IOException; import java.io.Serializable; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/process/ProcessStats.java b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/process/ProcessStats.java index 590b84e7307..f4c3cd2e08f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/process/ProcessStats.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/monitor/process/ProcessStats.java @@ -19,13 +19,13 @@ package org.elasticsearch.monitor.process; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.builder.XContentBuilder; import org.elasticsearch.util.SizeValue; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; import java.io.IOException; import java.io.Serializable; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/node/internal/InternalNode.java b/modules/elasticsearch/src/main/java/org/elasticsearch/node/internal/InternalNode.java index 17119608727..581045c1e5e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/node/internal/InternalNode.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/node/internal/InternalNode.java @@ -29,6 +29,7 @@ import org.elasticsearch.cluster.ClusterModule; import org.elasticsearch.cluster.ClusterNameModule; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.routing.RoutingService; +import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.component.Lifecycle; import org.elasticsearch.common.component.LifecycleComponent; import org.elasticsearch.common.http.client.HttpClientModule; @@ -37,6 +38,7 @@ import org.elasticsearch.common.inject.Guice; import org.elasticsearch.common.inject.Injector; import org.elasticsearch.common.inject.Injectors; import org.elasticsearch.common.inject.Module; +import org.elasticsearch.common.io.FileSystemUtils; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.network.NetworkModule; @@ -74,8 +76,6 @@ import org.elasticsearch.timer.TimerService; import org.elasticsearch.transport.TransportModule; import org.elasticsearch.transport.TransportService; import org.elasticsearch.util.ThreadLocals; -import org.elasticsearch.util.Tuple; -import org.elasticsearch.util.io.FileSystemUtils; import java.io.File; import java.util.ArrayList; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/node/internal/InternalSettingsPerparer.java b/modules/elasticsearch/src/main/java/org/elasticsearch/node/internal/InternalSettingsPerparer.java index 958e109e569..f0a45b0eed4 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/node/internal/InternalSettingsPerparer.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/node/internal/InternalSettingsPerparer.java @@ -20,12 +20,12 @@ package org.elasticsearch.node.internal; import org.elasticsearch.cluster.ClusterName; +import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.env.FailedToResolveConfigException; import org.elasticsearch.util.Names; -import org.elasticsearch.util.Tuple; import static org.elasticsearch.common.settings.ImmutableSettings.*; import static org.elasticsearch.util.Strings.*; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/plugins/PluginManager.java b/modules/elasticsearch/src/main/java/org/elasticsearch/plugins/PluginManager.java index ae96c6f20bd..e2eb2b97f06 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/plugins/PluginManager.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/plugins/PluginManager.java @@ -1,12 +1,12 @@ package org.elasticsearch.plugins; import org.elasticsearch.Version; +import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.http.client.HttpDownloadHelper; +import org.elasticsearch.common.io.FileSystemUtils; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.node.internal.InternalSettingsPerparer; -import org.elasticsearch.util.Tuple; -import org.elasticsearch.util.io.FileSystemUtils; import java.io.File; import java.io.FileNotFoundException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/plugins/PluginsService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/plugins/PluginsService.java index 4d6692f9897..39a20d73f08 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/plugins/PluginsService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/plugins/PluginsService.java @@ -28,9 +28,9 @@ import org.elasticsearch.common.component.CloseableIndexComponent; import org.elasticsearch.common.component.LifecycleComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Module; +import org.elasticsearch.common.io.Streams; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; -import org.elasticsearch.util.io.Streams; import java.io.*; import java.lang.reflect.Method; @@ -40,7 +40,7 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import static org.elasticsearch.common.collect.Maps.*; -import static org.elasticsearch.util.io.FileSystemUtils.*; +import static org.elasticsearch.common.io.FileSystemUtils.*; /** * @author kimchy (shay.banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java index 6eb5a1f294b..6259e71fcaa 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java @@ -23,6 +23,7 @@ import org.elasticsearch.Version; import org.elasticsearch.client.Client; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.util.concurrent.jsr166y.ThreadLocalRandom; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; @@ -30,7 +31,6 @@ import org.elasticsearch.common.xcontent.builder.XContentBuilder; import org.elasticsearch.rest.*; import org.elasticsearch.rest.action.support.RestXContentBuilder; import org.elasticsearch.util.Classes; -import org.elasticsearch.util.concurrent.jsr166y.ThreadLocalRandom; import java.io.IOException; import java.util.List; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/script/ScriptService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/script/ScriptService.java index f88032cd528..72aac1815a6 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/script/ScriptService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/script/ScriptService.java @@ -21,11 +21,11 @@ package org.elasticsearch.script; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.math.UnboxedMathUtils; import org.elasticsearch.common.mvel2.MVEL; import org.elasticsearch.common.mvel2.ParserContext; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.util.concurrent.ConcurrentCollections; -import org.elasticsearch.util.math.UnboxedMathUtils; +import org.elasticsearch.common.util.concurrent.ConcurrentCollections; import java.lang.reflect.Method; import java.lang.reflect.Modifier; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/Scroll.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/Scroll.java index 4d35bfe62ad..25f3136ff5e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/Scroll.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/Scroll.java @@ -19,10 +19,10 @@ package org.elasticsearch.search; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchHit.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchHit.java index d25cc8657ce..4031d2fd352 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchHit.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchHit.java @@ -21,9 +21,9 @@ package org.elasticsearch.search; import org.apache.lucene.search.Explanation; import org.elasticsearch.ElasticSearchParseException; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.search.highlight.HighlightField; -import org.elasticsearch.util.io.stream.Streamable; import java.util.Map; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchHitField.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchHitField.java index cc2802e27aa..82f337b5c20 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchHitField.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchHitField.java @@ -19,7 +19,7 @@ package org.elasticsearch.search; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.Streamable; import java.util.List; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchHits.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchHits.java index e7dcffb76ce..68122d8a009 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchHits.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchHits.java @@ -19,8 +19,8 @@ package org.elasticsearch.search; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.util.io.stream.Streamable; /** * The hits of a search request. diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchPhaseResult.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchPhaseResult.java index 70a08eb2f2e..921600818ca 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchPhaseResult.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchPhaseResult.java @@ -19,7 +19,7 @@ package org.elasticsearch.search; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.Streamable; /** * @author kimchy (shay.banon) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchService.java index fa6b0c447f7..6d6d48161cd 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchService.java @@ -28,6 +28,8 @@ import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.timer.Timeout; import org.elasticsearch.common.timer.TimerTask; +import org.elasticsearch.common.util.concurrent.ConcurrentCollections; +import org.elasticsearch.common.util.concurrent.ConcurrentMapLong; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.index.Index; @@ -55,8 +57,6 @@ import org.elasticsearch.search.query.QuerySearchResult; import org.elasticsearch.timer.TimerService; import org.elasticsearch.util.TimeValue; import org.elasticsearch.util.Unicode; -import org.elasticsearch.util.concurrent.ConcurrentCollections; -import org.elasticsearch.util.concurrent.ConcurrentMapLong; import java.io.IOException; import java.util.HashMap; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchShardTarget.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchShardTarget.java index f13e3a5f011..cbcd017e7b2 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchShardTarget.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchShardTarget.java @@ -19,9 +19,9 @@ package org.elasticsearch.search; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; import java.io.Serializable; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/action/SearchServiceTransportAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/action/SearchServiceTransportAction.java index 752100c4771..3244f1a84c8 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/action/SearchServiceTransportAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/action/SearchServiceTransportAction.java @@ -23,6 +23,8 @@ import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.LongStreamable; +import org.elasticsearch.common.io.stream.VoidStreamable; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.search.SearchService; @@ -35,8 +37,6 @@ import org.elasticsearch.search.internal.InternalSearchRequest; import org.elasticsearch.search.query.QuerySearchRequest; import org.elasticsearch.search.query.QuerySearchResult; import org.elasticsearch.transport.*; -import org.elasticsearch.util.io.stream.LongStreamable; -import org.elasticsearch.util.io.stream.VoidStreamable; /** * An encapsulation of {@link org.elasticsearch.search.SearchService} operations exposed through diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java index 6e678a7d415..7afca224616 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java @@ -20,6 +20,7 @@ package org.elasticsearch.search.builder; import org.elasticsearch.common.collect.Lists; +import org.elasticsearch.common.io.FastByteArrayOutputStream; import org.elasticsearch.common.trove.TObjectFloatHashMap; import org.elasticsearch.common.trove.TObjectFloatIterator; import org.elasticsearch.common.xcontent.ToXContent; @@ -28,7 +29,6 @@ import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.builder.BinaryXContentBuilder; import org.elasticsearch.common.xcontent.builder.XContentBuilder; import org.elasticsearch.index.query.xcontent.XContentQueryBuilder; -import org.elasticsearch.util.io.FastByteArrayOutputStream; import java.io.IOException; import java.util.ArrayList; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/dfs/AggregatedDfs.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/dfs/AggregatedDfs.java index fb199a20af0..c60439406d1 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/dfs/AggregatedDfs.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/dfs/AggregatedDfs.java @@ -20,11 +20,11 @@ package org.elasticsearch.search.dfs; import org.apache.lucene.index.Term; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.trove.ExtTObjectIntHasMap; import org.elasticsearch.common.trove.TObjectIntProcedure; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/dfs/DfsSearchResult.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/dfs/DfsSearchResult.java index e627bae1cb5..fd9444d3433 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/dfs/DfsSearchResult.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/dfs/DfsSearchResult.java @@ -20,10 +20,10 @@ package org.elasticsearch.search.dfs; import org.apache.lucene.index.Term; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.search.SearchPhaseResult; import org.elasticsearch.search.SearchShardTarget; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.IOException; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/FacetsParseElement.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/FacetsParseElement.java index 6bdf3f4fc43..718399559d4 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/FacetsParseElement.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/FacetsParseElement.java @@ -22,6 +22,7 @@ package org.elasticsearch.search.facets; import org.apache.lucene.search.Filter; import org.elasticsearch.common.collect.ImmutableMap; import org.elasticsearch.common.collect.Lists; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.index.query.xcontent.XContentIndexQueryParser; import org.elasticsearch.search.SearchParseElement; @@ -33,11 +34,10 @@ import org.elasticsearch.search.facets.query.QueryFacetCollectorParser; import org.elasticsearch.search.facets.statistical.StatisticalFacetCollectorParser; import org.elasticsearch.search.facets.terms.TermsFacetCollectorParser; import org.elasticsearch.search.internal.SearchContext; -import org.elasticsearch.util.MapBuilder; import java.util.List; -import static org.elasticsearch.util.MapBuilder.*; +import static org.elasticsearch.common.collect.MapBuilder.*; /** *
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/histogram/InternalHistogramFacet.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/histogram/InternalHistogramFacet.java
index c10a1dbd585..e7b8d9b6ea1 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/histogram/InternalHistogramFacet.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/histogram/InternalHistogramFacet.java
@@ -20,6 +20,8 @@
 package org.elasticsearch.search.facets.histogram;
 
 import org.elasticsearch.common.collect.ImmutableList;
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
 import org.elasticsearch.common.trove.TLongDoubleHashMap;
 import org.elasticsearch.common.trove.TLongDoubleIterator;
 import org.elasticsearch.common.trove.TLongLongHashMap;
@@ -27,8 +29,6 @@ import org.elasticsearch.common.trove.TLongLongIterator;
 import org.elasticsearch.common.xcontent.builder.XContentBuilder;
 import org.elasticsearch.search.facets.Facet;
 import org.elasticsearch.search.facets.internal.InternalFacet;
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.StreamOutput;
 
 import java.io.IOException;
 import java.util.Collection;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/internal/InternalFacet.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/internal/InternalFacet.java
index 4b514339a3b..9aa66890720 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/internal/InternalFacet.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/internal/InternalFacet.java
@@ -19,9 +19,9 @@
 
 package org.elasticsearch.search.facets.internal;
 
+import org.elasticsearch.common.io.stream.Streamable;
 import org.elasticsearch.common.xcontent.ToXContent;
 import org.elasticsearch.search.facets.Facet;
-import org.elasticsearch.util.io.stream.Streamable;
 
 /**
  * @author kimchy (shay.banon)
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/internal/InternalFacets.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/internal/InternalFacets.java
index d4c8014ad15..a1723a2409f 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/internal/InternalFacets.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/internal/InternalFacets.java
@@ -22,6 +22,9 @@ package org.elasticsearch.search.facets.internal;
 import org.elasticsearch.common.collect.ImmutableList;
 import org.elasticsearch.common.collect.ImmutableMap;
 import org.elasticsearch.common.collect.Lists;
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.io.stream.Streamable;
 import org.elasticsearch.common.xcontent.ToXContent;
 import org.elasticsearch.common.xcontent.builder.XContentBuilder;
 import org.elasticsearch.search.facets.Facet;
@@ -30,9 +33,6 @@ import org.elasticsearch.search.facets.histogram.InternalHistogramFacet;
 import org.elasticsearch.search.facets.query.InternalQueryFacet;
 import org.elasticsearch.search.facets.statistical.InternalStatisticalFacet;
 import org.elasticsearch.search.facets.terms.InternalTermsFacet;
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.StreamOutput;
-import org.elasticsearch.util.io.stream.Streamable;
 
 import java.io.IOException;
 import java.util.Iterator;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/query/InternalQueryFacet.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/query/InternalQueryFacet.java
index 5e91ddcc34f..f6eb8b9f06f 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/query/InternalQueryFacet.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/query/InternalQueryFacet.java
@@ -19,11 +19,11 @@
 
 package org.elasticsearch.search.facets.query;
 
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
 import org.elasticsearch.common.xcontent.builder.XContentBuilder;
 import org.elasticsearch.search.facets.Facet;
 import org.elasticsearch.search.facets.internal.InternalFacet;
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.StreamOutput;
 
 import java.io.IOException;
 
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/statistical/InternalStatisticalFacet.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/statistical/InternalStatisticalFacet.java
index e22af6a7066..ba81e5170cb 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/statistical/InternalStatisticalFacet.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/statistical/InternalStatisticalFacet.java
@@ -19,11 +19,11 @@
 
 package org.elasticsearch.search.facets.statistical;
 
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
 import org.elasticsearch.common.xcontent.builder.XContentBuilder;
 import org.elasticsearch.search.facets.Facet;
 import org.elasticsearch.search.facets.internal.InternalFacet;
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.StreamOutput;
 
 import java.io.IOException;
 
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/terms/InternalTermsFacet.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/terms/InternalTermsFacet.java
index a34259ff7c4..8baaaa15be5 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/terms/InternalTermsFacet.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/terms/InternalTermsFacet.java
@@ -19,16 +19,16 @@
 
 package org.elasticsearch.search.facets.terms;
 
+import org.elasticsearch.common.collect.BoundedTreeSet;
 import org.elasticsearch.common.collect.ImmutableList;
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
 import org.elasticsearch.common.trove.TObjectIntHashMap;
 import org.elasticsearch.common.trove.TObjectIntIterator;
 import org.elasticsearch.common.xcontent.builder.XContentBuilder;
 import org.elasticsearch.search.facets.Facet;
 import org.elasticsearch.search.facets.internal.InternalFacet;
-import org.elasticsearch.util.BoundedTreeSet;
 import org.elasticsearch.util.ThreadLocals;
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.StreamOutput;
 
 import java.io.IOException;
 import java.util.ArrayList;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/terms/TermsFacetCollector.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/terms/TermsFacetCollector.java
index 57c31d72ff7..e0cdc861455 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/terms/TermsFacetCollector.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/terms/TermsFacetCollector.java
@@ -20,6 +20,7 @@
 package org.elasticsearch.search.facets.terms;
 
 import org.apache.lucene.index.IndexReader;
+import org.elasticsearch.common.collect.BoundedTreeSet;
 import org.elasticsearch.common.collect.ImmutableList;
 import org.elasticsearch.common.trove.TObjectIntHashMap;
 import org.elasticsearch.common.trove.TObjectIntIterator;
@@ -29,7 +30,6 @@ import org.elasticsearch.index.mapper.FieldMapper;
 import org.elasticsearch.index.mapper.MapperService;
 import org.elasticsearch.search.facets.Facet;
 import org.elasticsearch.search.facets.support.AbstractFacetCollector;
-import org.elasticsearch.util.BoundedTreeSet;
 import org.elasticsearch.util.ThreadLocals;
 
 import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/fetch/FetchSearchRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/fetch/FetchSearchRequest.java
index b1f683b697e..75c90225c34 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/fetch/FetchSearchRequest.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/fetch/FetchSearchRequest.java
@@ -19,10 +19,10 @@
 
 package org.elasticsearch.search.fetch;
 
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.io.stream.Streamable;
 import org.elasticsearch.common.trove.ExtTIntArrayList;
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.StreamOutput;
-import org.elasticsearch.util.io.stream.Streamable;
 
 import java.io.IOException;
 
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/fetch/FetchSearchResult.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/fetch/FetchSearchResult.java
index 0ab56849ca1..c9edeff1f72 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/fetch/FetchSearchResult.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/fetch/FetchSearchResult.java
@@ -19,11 +19,11 @@
 
 package org.elasticsearch.search.fetch;
 
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.io.stream.Streamable;
 import org.elasticsearch.search.SearchShardTarget;
 import org.elasticsearch.search.internal.InternalSearchHits;
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.StreamOutput;
-import org.elasticsearch.util.io.stream.Streamable;
 
 import java.io.IOException;
 
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/fetch/QueryFetchSearchResult.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/fetch/QueryFetchSearchResult.java
index 48e3d11e571..66bb522b1ae 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/fetch/QueryFetchSearchResult.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/fetch/QueryFetchSearchResult.java
@@ -19,12 +19,12 @@
 
 package org.elasticsearch.search.fetch;
 
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.io.stream.Streamable;
 import org.elasticsearch.search.SearchShardTarget;
 import org.elasticsearch.search.query.QuerySearchResult;
 import org.elasticsearch.search.query.QuerySearchResultProvider;
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.StreamOutput;
-import org.elasticsearch.util.io.stream.Streamable;
 
 import java.io.IOException;
 
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/highlight/HighlightField.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/highlight/HighlightField.java
index cab71023922..a01d9f0d6c8 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/highlight/HighlightField.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/highlight/HighlightField.java
@@ -19,10 +19,10 @@
 
 package org.elasticsearch.search.highlight;
 
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.io.stream.Streamable;
 import org.elasticsearch.util.Strings;
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.StreamOutput;
-import org.elasticsearch.util.io.stream.Streamable;
 
 import java.io.IOException;
 import java.util.Arrays;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalScrollSearchRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalScrollSearchRequest.java
index d1176a93b8f..5326aaf891b 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalScrollSearchRequest.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalScrollSearchRequest.java
@@ -19,10 +19,10 @@
 
 package org.elasticsearch.search.internal;
 
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.io.stream.Streamable;
 import org.elasticsearch.search.Scroll;
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.StreamOutput;
-import org.elasticsearch.util.io.stream.Streamable;
 
 import java.io.IOException;
 
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchHit.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchHit.java
index 76fbc5d519d..289bc945e94 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchHit.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchHit.java
@@ -22,6 +22,8 @@ package org.elasticsearch.search.internal;
 import org.apache.lucene.search.Explanation;
 import org.elasticsearch.ElasticSearchParseException;
 import org.elasticsearch.common.collect.ImmutableMap;
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
 import org.elasticsearch.common.trove.TIntObjectHashMap;
 import org.elasticsearch.common.xcontent.XContentFactory;
 import org.elasticsearch.common.xcontent.XContentParser;
@@ -31,8 +33,6 @@ import org.elasticsearch.search.SearchHitField;
 import org.elasticsearch.search.SearchShardTarget;
 import org.elasticsearch.search.highlight.HighlightField;
 import org.elasticsearch.util.Unicode;
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.StreamOutput;
 
 import javax.annotation.Nullable;
 import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchHitField.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchHitField.java
index e3e0cc3bec1..3e95e8d7f05 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchHitField.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchHitField.java
@@ -19,10 +19,10 @@
 
 package org.elasticsearch.search.internal;
 
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
 import org.elasticsearch.common.lucene.Lucene;
 import org.elasticsearch.search.SearchHitField;
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.StreamOutput;
 
 import java.io.IOException;
 import java.util.ArrayList;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchHits.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchHits.java
index f91e4f0b6ef..0cd9042f7c8 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchHits.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchHits.java
@@ -20,13 +20,13 @@
 package org.elasticsearch.search.internal;
 
 import org.elasticsearch.common.collect.Iterators;
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
 import org.elasticsearch.common.trove.TIntObjectHashMap;
 import org.elasticsearch.common.xcontent.builder.XContentBuilder;
 import org.elasticsearch.search.SearchHit;
 import org.elasticsearch.search.SearchHits;
 import org.elasticsearch.search.SearchShardTarget;
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.StreamOutput;
 
 import java.io.IOException;
 import java.util.IdentityHashMap;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchRequest.java
index f813733083e..9836817e4cd 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchRequest.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchRequest.java
@@ -20,13 +20,13 @@
 package org.elasticsearch.search.internal;
 
 import org.elasticsearch.cluster.routing.ShardRouting;
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.io.stream.Streamable;
 import org.elasticsearch.search.Scroll;
 import org.elasticsearch.util.Bytes;
 import org.elasticsearch.util.Strings;
 import org.elasticsearch.util.TimeValue;
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.StreamOutput;
-import org.elasticsearch.util.io.stream.Streamable;
 
 import java.io.IOException;
 
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchResponse.java
index 3f32f85f4b8..cf8d6d48954 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchResponse.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchResponse.java
@@ -19,14 +19,14 @@
 
 package org.elasticsearch.search.internal;
 
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.io.stream.Streamable;
 import org.elasticsearch.common.xcontent.ToXContent;
 import org.elasticsearch.common.xcontent.builder.XContentBuilder;
 import org.elasticsearch.search.SearchHits;
 import org.elasticsearch.search.facets.Facets;
 import org.elasticsearch.search.facets.internal.InternalFacets;
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.StreamOutput;
-import org.elasticsearch.util.io.stream.Streamable;
 
 import java.io.IOException;
 
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/SearchContext.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/SearchContext.java
index f36e40bade6..9b2560ef422 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/SearchContext.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/SearchContext.java
@@ -23,6 +23,7 @@ import org.apache.lucene.search.Query;
 import org.apache.lucene.search.Sort;
 import org.apache.lucene.store.AlreadyClosedException;
 import org.elasticsearch.ElasticSearchException;
+import org.elasticsearch.common.lease.Releasable;
 import org.elasticsearch.common.timer.Timeout;
 import org.elasticsearch.index.cache.field.data.FieldDataCache;
 import org.elasticsearch.index.cache.filter.FilterCache;
@@ -43,7 +44,6 @@ import org.elasticsearch.search.fetch.script.ScriptFieldsContext;
 import org.elasticsearch.search.highlight.SearchContextHighlight;
 import org.elasticsearch.search.query.QuerySearchResult;
 import org.elasticsearch.util.TimeValue;
-import org.elasticsearch.util.lease.Releasable;
 
 import java.io.IOException;
 import java.util.List;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/query/QuerySearchRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/query/QuerySearchRequest.java
index 4181898f398..0869a881bac 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/query/QuerySearchRequest.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/query/QuerySearchRequest.java
@@ -19,10 +19,10 @@
 
 package org.elasticsearch.search.query;
 
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.io.stream.Streamable;
 import org.elasticsearch.search.dfs.AggregatedDfs;
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.StreamOutput;
-import org.elasticsearch.util.io.stream.Streamable;
 
 import java.io.IOException;
 
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/query/QuerySearchResult.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/query/QuerySearchResult.java
index 7f397e1ebda..3f8b2973d5f 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/query/QuerySearchResult.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/query/QuerySearchResult.java
@@ -20,12 +20,12 @@
 package org.elasticsearch.search.query;
 
 import org.apache.lucene.search.TopDocs;
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.io.stream.Streamable;
 import org.elasticsearch.search.SearchShardTarget;
 import org.elasticsearch.search.facets.Facets;
 import org.elasticsearch.search.facets.internal.InternalFacets;
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.StreamOutput;
-import org.elasticsearch.util.io.stream.Streamable;
 
 import java.io.IOException;
 
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/ThreadPoolInfo.java b/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/ThreadPoolInfo.java
index 486e46317e1..437149bac02 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/ThreadPoolInfo.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/ThreadPoolInfo.java
@@ -19,11 +19,11 @@
 
 package org.elasticsearch.threadpool;
 
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.io.stream.Streamable;
 import org.elasticsearch.common.xcontent.ToXContent;
 import org.elasticsearch.common.xcontent.builder.XContentBuilder;
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.StreamOutput;
-import org.elasticsearch.util.io.stream.Streamable;
 
 import java.io.IOException;
 import java.io.Serializable;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/ThreadPoolStats.java b/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/ThreadPoolStats.java
index 4ed17c22915..24d58093a69 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/ThreadPoolStats.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/ThreadPoolStats.java
@@ -19,11 +19,11 @@
 
 package org.elasticsearch.threadpool;
 
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.io.stream.Streamable;
 import org.elasticsearch.common.xcontent.ToXContent;
 import org.elasticsearch.common.xcontent.builder.XContentBuilder;
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.StreamOutput;
-import org.elasticsearch.util.io.stream.Streamable;
 
 import java.io.IOException;
 import java.io.Serializable;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/blocking/BlockingThreadPool.java b/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/blocking/BlockingThreadPool.java
index bed863c63ef..2652b5cde9c 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/blocking/BlockingThreadPool.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/blocking/BlockingThreadPool.java
@@ -21,11 +21,11 @@ package org.elasticsearch.threadpool.blocking;
 
 import org.elasticsearch.common.inject.Inject;
 import org.elasticsearch.common.settings.Settings;
+import org.elasticsearch.common.util.concurrent.DynamicExecutors;
 import org.elasticsearch.threadpool.support.AbstractThreadPool;
 import org.elasticsearch.util.SizeUnit;
 import org.elasticsearch.util.SizeValue;
 import org.elasticsearch.util.TimeValue;
-import org.elasticsearch.util.concurrent.DynamicExecutors;
 
 import java.util.concurrent.Executors;
 import java.util.concurrent.ThreadPoolExecutor;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/cached/CachedThreadPool.java b/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/cached/CachedThreadPool.java
index 008d41d708f..be9de37e2ca 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/cached/CachedThreadPool.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/cached/CachedThreadPool.java
@@ -21,9 +21,9 @@ package org.elasticsearch.threadpool.cached;
 
 import org.elasticsearch.common.inject.Inject;
 import org.elasticsearch.common.settings.Settings;
+import org.elasticsearch.common.util.concurrent.DynamicExecutors;
 import org.elasticsearch.threadpool.support.AbstractThreadPool;
 import org.elasticsearch.util.TimeValue;
-import org.elasticsearch.util.concurrent.DynamicExecutors;
 
 import java.util.concurrent.Executors;
 import java.util.concurrent.SynchronousQueue;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/scaling/ScalingThreadPool.java b/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/scaling/ScalingThreadPool.java
index dee92be3a29..bb263232512 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/scaling/ScalingThreadPool.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/threadpool/scaling/ScalingThreadPool.java
@@ -21,10 +21,10 @@ package org.elasticsearch.threadpool.scaling;
 
 import org.elasticsearch.common.inject.Inject;
 import org.elasticsearch.common.settings.Settings;
+import org.elasticsearch.common.util.concurrent.DynamicExecutors;
+import org.elasticsearch.common.util.concurrent.ScalingThreadPoolExecutor;
 import org.elasticsearch.threadpool.support.AbstractThreadPool;
 import org.elasticsearch.util.TimeValue;
-import org.elasticsearch.util.concurrent.DynamicExecutors;
-import org.elasticsearch.util.concurrent.ScalingThreadPoolExecutor;
 
 import java.util.concurrent.Executors;
 import java.util.concurrent.ThreadPoolExecutor;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/timer/TimerService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/timer/TimerService.java
index a7b7844cabd..37d1b237bbc 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/timer/TimerService.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/timer/TimerService.java
@@ -33,8 +33,8 @@ import org.elasticsearch.util.TimeValue;
 import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.TimeUnit;
 
+import static org.elasticsearch.common.util.concurrent.DynamicExecutors.*;
 import static org.elasticsearch.util.TimeValue.*;
-import static org.elasticsearch.util.concurrent.DynamicExecutors.*;
 
 /**
  * @author kimchy (Shay Banon)
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/ActionTransportRequestHandler.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/ActionTransportRequestHandler.java
index 4e87c02eb9f..a1d3c1b5799 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/ActionTransportRequestHandler.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/ActionTransportRequestHandler.java
@@ -19,7 +19,7 @@
 
 package org.elasticsearch.transport;
 
-import org.elasticsearch.util.io.stream.Streamable;
+import org.elasticsearch.common.io.stream.Streamable;
 
 /**
  * @author kimchy (Shay Banon)
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/BaseTransportRequestHandler.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/BaseTransportRequestHandler.java
index 4ccabae5cfb..95c33bec43f 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/BaseTransportRequestHandler.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/BaseTransportRequestHandler.java
@@ -19,7 +19,7 @@
 
 package org.elasticsearch.transport;
 
-import org.elasticsearch.util.io.stream.Streamable;
+import org.elasticsearch.common.io.stream.Streamable;
 
 /**
  * A simple based class that always spawns.
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/BaseTransportResponseHandler.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/BaseTransportResponseHandler.java
index ec9fa7646ad..fb88ff82d91 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/BaseTransportResponseHandler.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/BaseTransportResponseHandler.java
@@ -19,7 +19,7 @@
 
 package org.elasticsearch.transport;
 
-import org.elasticsearch.util.io.stream.Streamable;
+import org.elasticsearch.common.io.stream.Streamable;
 
 /**
  * A simple based class that always spawns.
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/FutureTransportResponseHandler.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/FutureTransportResponseHandler.java
index 1b4f3ecae1a..a1f4957b13b 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/FutureTransportResponseHandler.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/FutureTransportResponseHandler.java
@@ -19,7 +19,7 @@
 
 package org.elasticsearch.transport;
 
-import org.elasticsearch.util.io.stream.Streamable;
+import org.elasticsearch.common.io.stream.Streamable;
 
 /**
  * A response handler to be used when all interaction will be done through the {@link TransportFuture}.
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/PlainTransportFuture.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/PlainTransportFuture.java
index cd8537c6fc3..68b214bef7e 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/PlainTransportFuture.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/PlainTransportFuture.java
@@ -22,8 +22,8 @@ package org.elasticsearch.transport;
 import org.elasticsearch.ElasticSearchException;
 import org.elasticsearch.ElasticSearchInterruptedException;
 import org.elasticsearch.ElasticSearchTimeoutException;
-import org.elasticsearch.util.concurrent.AbstractFuture;
-import org.elasticsearch.util.io.stream.Streamable;
+import org.elasticsearch.common.io.stream.Streamable;
+import org.elasticsearch.common.util.concurrent.AbstractFuture;
 
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/Transport.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/Transport.java
index a582ed90346..8e925a5f98d 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/Transport.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/Transport.java
@@ -21,9 +21,9 @@ package org.elasticsearch.transport;
 
 import org.elasticsearch.cluster.node.DiscoveryNode;
 import org.elasticsearch.common.component.LifecycleComponent;
+import org.elasticsearch.common.io.stream.Streamable;
 import org.elasticsearch.common.transport.BoundTransportAddress;
 import org.elasticsearch.common.transport.TransportAddress;
-import org.elasticsearch.util.io.stream.Streamable;
 
 import java.io.IOException;
 
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportChannel.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportChannel.java
index 9a08faa14f4..19d7c21e898 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportChannel.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportChannel.java
@@ -19,7 +19,7 @@
 
 package org.elasticsearch.transport;
 
-import org.elasticsearch.util.io.stream.Streamable;
+import org.elasticsearch.common.io.stream.Streamable;
 
 import java.io.IOException;
 
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportInfo.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportInfo.java
index d9e4eca113e..6112ee40467 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportInfo.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportInfo.java
@@ -19,12 +19,12 @@
 
 package org.elasticsearch.transport;
 
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.io.stream.Streamable;
 import org.elasticsearch.common.transport.BoundTransportAddress;
 import org.elasticsearch.common.xcontent.ToXContent;
 import org.elasticsearch.common.xcontent.builder.XContentBuilder;
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.StreamOutput;
-import org.elasticsearch.util.io.stream.Streamable;
 
 import java.io.IOException;
 import java.io.Serializable;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportRequestHandler.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportRequestHandler.java
index 95a947d1096..5c193537c08 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportRequestHandler.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportRequestHandler.java
@@ -19,7 +19,7 @@
 
 package org.elasticsearch.transport;
 
-import org.elasticsearch.util.io.stream.Streamable;
+import org.elasticsearch.common.io.stream.Streamable;
 
 /**
  * @author kimchy (Shay Banon)
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportResponseHandler.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportResponseHandler.java
index 6bb95e7d7c7..0ffbdbc6736 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportResponseHandler.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportResponseHandler.java
@@ -19,7 +19,7 @@
 
 package org.elasticsearch.transport;
 
-import org.elasticsearch.util.io.stream.Streamable;
+import org.elasticsearch.common.io.stream.Streamable;
 
 /**
  * @author kimchy (Shay Banon)
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportService.java
index f18b9f1ede8..5cf2085d229 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportService.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportService.java
@@ -23,17 +23,17 @@ import org.elasticsearch.ElasticSearchException;
 import org.elasticsearch.cluster.node.DiscoveryNode;
 import org.elasticsearch.common.component.AbstractLifecycleComponent;
 import org.elasticsearch.common.inject.Inject;
+import org.elasticsearch.common.io.stream.Streamable;
 import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.common.timer.Timeout;
 import org.elasticsearch.common.timer.TimerTask;
 import org.elasticsearch.common.transport.BoundTransportAddress;
 import org.elasticsearch.common.transport.TransportAddress;
+import org.elasticsearch.common.util.concurrent.ConcurrentCollections;
+import org.elasticsearch.common.util.concurrent.ConcurrentMapLong;
 import org.elasticsearch.threadpool.ThreadPool;
 import org.elasticsearch.timer.TimerService;
 import org.elasticsearch.util.TimeValue;
-import org.elasticsearch.util.concurrent.ConcurrentCollections;
-import org.elasticsearch.util.concurrent.ConcurrentMapLong;
-import org.elasticsearch.util.io.stream.Streamable;
 
 import java.util.Collections;
 import java.util.LinkedHashMap;
@@ -43,7 +43,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.atomic.AtomicLong;
 
 import static org.elasticsearch.common.settings.ImmutableSettings.Builder.*;
-import static org.elasticsearch.util.concurrent.ConcurrentCollections.*;
+import static org.elasticsearch.common.util.concurrent.ConcurrentCollections.*;
 
 /**
  * @author kimchy (shay.banon)
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportStats.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportStats.java
index 222aa351820..1d4d5163ed3 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportStats.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/TransportStats.java
@@ -19,12 +19,12 @@
 
 package org.elasticsearch.transport;
 
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.io.stream.Streamable;
 import org.elasticsearch.common.xcontent.ToXContent;
 import org.elasticsearch.common.xcontent.builder.XContentBuilder;
 import org.elasticsearch.util.SizeValue;
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.StreamOutput;
-import org.elasticsearch.util.io.stream.Streamable;
 
 import java.io.IOException;
 import java.io.Serializable;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/VoidTransportResponseHandler.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/VoidTransportResponseHandler.java
index ed06bd767a1..f0ce7b42d0d 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/VoidTransportResponseHandler.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/VoidTransportResponseHandler.java
@@ -19,7 +19,7 @@
 
 package org.elasticsearch.transport;
 
-import org.elasticsearch.util.io.stream.VoidStreamable;
+import org.elasticsearch.common.io.stream.VoidStreamable;
 
 /**
  * @author kimchy (Shay Banon)
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/local/LocalTransport.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/local/LocalTransport.java
index af6c90fcee0..4ba3de345cd 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/local/LocalTransport.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/local/LocalTransport.java
@@ -23,6 +23,8 @@ import org.elasticsearch.ElasticSearchException;
 import org.elasticsearch.cluster.node.DiscoveryNode;
 import org.elasticsearch.common.component.AbstractLifecycleComponent;
 import org.elasticsearch.common.inject.Inject;
+import org.elasticsearch.common.io.ThrowableObjectInputStream;
+import org.elasticsearch.common.io.stream.*;
 import org.elasticsearch.common.settings.ImmutableSettings;
 import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.common.transport.BoundTransportAddress;
@@ -30,8 +32,6 @@ import org.elasticsearch.common.transport.LocalTransportAddress;
 import org.elasticsearch.common.transport.TransportAddress;
 import org.elasticsearch.threadpool.ThreadPool;
 import org.elasticsearch.transport.*;
-import org.elasticsearch.util.io.ThrowableObjectInputStream;
-import org.elasticsearch.util.io.stream.*;
 
 import javax.annotation.Nullable;
 import java.io.IOException;
@@ -39,8 +39,8 @@ import java.util.Map;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.atomic.AtomicLong;
 
+import static org.elasticsearch.common.util.concurrent.ConcurrentCollections.*;
 import static org.elasticsearch.transport.Transport.Helper.*;
-import static org.elasticsearch.util.concurrent.ConcurrentCollections.*;
 
 /**
  * @author kimchy (shay.banon)
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/local/LocalTransportChannel.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/local/LocalTransportChannel.java
index b7ceb5785fc..aa5b4933894 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/local/LocalTransportChannel.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/local/LocalTransportChannel.java
@@ -19,14 +19,14 @@
 
 package org.elasticsearch.transport.local;
 
+import org.elasticsearch.common.io.ThrowableObjectOutputStream;
+import org.elasticsearch.common.io.stream.BytesStreamOutput;
+import org.elasticsearch.common.io.stream.HandlesStreamOutput;
+import org.elasticsearch.common.io.stream.Streamable;
 import org.elasticsearch.transport.NotSerializableTransportException;
 import org.elasticsearch.transport.RemoteTransportException;
 import org.elasticsearch.transport.Transport;
 import org.elasticsearch.transport.TransportChannel;
-import org.elasticsearch.util.io.ThrowableObjectOutputStream;
-import org.elasticsearch.util.io.stream.BytesStreamOutput;
-import org.elasticsearch.util.io.stream.HandlesStreamOutput;
-import org.elasticsearch.util.io.stream.Streamable;
 
 import java.io.IOException;
 import java.io.NotSerializableException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/ChannelBufferStreamInput.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/ChannelBufferStreamInput.java
index 2f90f7ccfed..7866856055e 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/ChannelBufferStreamInput.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/ChannelBufferStreamInput.java
@@ -19,13 +19,13 @@
 
 package org.elasticsearch.transport.netty;
 
+import org.elasticsearch.common.io.stream.StreamInput;
 import org.elasticsearch.common.netty.buffer.ChannelBuffer;
-import org.elasticsearch.util.io.stream.StreamInput;
 
 import java.io.IOException;
 
 /**
- * A Netty {@link org.elasticsearch.common.netty.buffer.ChannelBuffer} based {@link org.elasticsearch.util.io.stream.StreamInput}.
+ * A Netty {@link org.elasticsearch.common.netty.buffer.ChannelBuffer} based {@link org.elasticsearch.common.io.stream.StreamInput}.
  *
  * @author kimchy (shay.banon)
  */
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/MessageChannelHandler.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/MessageChannelHandler.java
index f40a4ae16ce..ddc40b0702e 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/MessageChannelHandler.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/MessageChannelHandler.java
@@ -19,15 +19,15 @@
 
 package org.elasticsearch.transport.netty;
 
+import org.elasticsearch.common.io.ThrowableObjectInputStream;
+import org.elasticsearch.common.io.stream.HandlesStreamInput;
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.Streamable;
 import org.elasticsearch.common.logging.ESLogger;
 import org.elasticsearch.common.netty.buffer.ChannelBuffer;
 import org.elasticsearch.common.netty.channel.*;
 import org.elasticsearch.threadpool.ThreadPool;
 import org.elasticsearch.transport.*;
-import org.elasticsearch.util.io.ThrowableObjectInputStream;
-import org.elasticsearch.util.io.stream.HandlesStreamInput;
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.Streamable;
 
 import java.io.IOException;
 
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/NettyTransport.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/NettyTransport.java
index 72a560d4251..2bf96db4235 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/NettyTransport.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/NettyTransport.java
@@ -25,6 +25,9 @@ import org.elasticsearch.cluster.node.DiscoveryNode;
 import org.elasticsearch.common.collect.Lists;
 import org.elasticsearch.common.component.AbstractLifecycleComponent;
 import org.elasticsearch.common.inject.Inject;
+import org.elasticsearch.common.io.stream.BytesStreamOutput;
+import org.elasticsearch.common.io.stream.HandlesStreamOutput;
+import org.elasticsearch.common.io.stream.Streamable;
 import org.elasticsearch.common.netty.OpenChannelsHandler;
 import org.elasticsearch.common.netty.bootstrap.ClientBootstrap;
 import org.elasticsearch.common.netty.bootstrap.ServerBootstrap;
@@ -47,9 +50,6 @@ import org.elasticsearch.transport.*;
 import org.elasticsearch.util.SizeValue;
 import org.elasticsearch.util.Strings;
 import org.elasticsearch.util.TimeValue;
-import org.elasticsearch.util.io.stream.BytesStreamOutput;
-import org.elasticsearch.util.io.stream.HandlesStreamOutput;
-import org.elasticsearch.util.io.stream.Streamable;
 
 import java.io.IOException;
 import java.net.InetAddress;
@@ -69,10 +69,10 @@ import static org.elasticsearch.common.collect.Lists.*;
 import static org.elasticsearch.common.network.NetworkService.TcpSettings.*;
 import static org.elasticsearch.common.settings.ImmutableSettings.Builder.*;
 import static org.elasticsearch.common.transport.NetworkExceptionHelper.*;
+import static org.elasticsearch.common.util.concurrent.ConcurrentCollections.*;
+import static org.elasticsearch.common.util.concurrent.DynamicExecutors.*;
 import static org.elasticsearch.transport.Transport.Helper.*;
 import static org.elasticsearch.util.TimeValue.*;
-import static org.elasticsearch.util.concurrent.ConcurrentCollections.*;
-import static org.elasticsearch.util.concurrent.DynamicExecutors.*;
 
 /**
  * @author kimchy (shay.banon)
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/NettyTransportChannel.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/NettyTransportChannel.java
index b74f15f9c45..b551687c6e2 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/NettyTransportChannel.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/NettyTransportChannel.java
@@ -19,16 +19,16 @@
 
 package org.elasticsearch.transport.netty;
 
+import org.elasticsearch.common.io.ThrowableObjectOutputStream;
+import org.elasticsearch.common.io.stream.BytesStreamOutput;
+import org.elasticsearch.common.io.stream.HandlesStreamOutput;
+import org.elasticsearch.common.io.stream.Streamable;
 import org.elasticsearch.common.netty.buffer.ChannelBuffer;
 import org.elasticsearch.common.netty.buffer.ChannelBuffers;
 import org.elasticsearch.common.netty.channel.Channel;
 import org.elasticsearch.transport.NotSerializableTransportException;
 import org.elasticsearch.transport.RemoteTransportException;
 import org.elasticsearch.transport.TransportChannel;
-import org.elasticsearch.util.io.ThrowableObjectOutputStream;
-import org.elasticsearch.util.io.stream.BytesStreamOutput;
-import org.elasticsearch.util.io.stream.HandlesStreamOutput;
-import org.elasticsearch.util.io.stream.Streamable;
 
 import java.io.IOException;
 import java.io.NotSerializableException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/Names.java b/modules/elasticsearch/src/main/java/org/elasticsearch/util/Names.java
index 28384b31599..549fee26db7 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/Names.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/util/Names.java
@@ -19,7 +19,7 @@
 
 package org.elasticsearch.util;
 
-import org.elasticsearch.util.concurrent.jsr166y.ThreadLocalRandom;
+import org.elasticsearch.common.util.concurrent.jsr166y.ThreadLocalRandom;
 
 import java.io.BufferedReader;
 import java.io.IOException;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/Percent.java b/modules/elasticsearch/src/main/java/org/elasticsearch/util/Percent.java
index d1611cc5c21..889582e22e9 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/Percent.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/util/Percent.java
@@ -19,9 +19,9 @@
 
 package org.elasticsearch.util;
 
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.StreamOutput;
-import org.elasticsearch.util.io.stream.Streamable;
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.io.stream.Streamable;
 
 import java.io.IOException;
 import java.io.Serializable;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/SizeValue.java b/modules/elasticsearch/src/main/java/org/elasticsearch/util/SizeValue.java
index 135c290206b..85f6c06b991 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/SizeValue.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/util/SizeValue.java
@@ -20,9 +20,9 @@
 package org.elasticsearch.util;
 
 import org.elasticsearch.ElasticSearchParseException;
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.StreamOutput;
-import org.elasticsearch.util.io.stream.Streamable;
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.io.stream.Streamable;
 
 import java.io.IOException;
 import java.io.Serializable;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/TimeValue.java b/modules/elasticsearch/src/main/java/org/elasticsearch/util/TimeValue.java
index 50861d226ab..024ecf062c8 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/TimeValue.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/util/TimeValue.java
@@ -20,13 +20,13 @@
 package org.elasticsearch.util;
 
 import org.elasticsearch.ElasticSearchParseException;
+import org.elasticsearch.common.io.stream.StreamInput;
+import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.common.io.stream.Streamable;
 import org.elasticsearch.common.joda.time.Period;
 import org.elasticsearch.common.joda.time.PeriodType;
 import org.elasticsearch.common.joda.time.format.PeriodFormat;
 import org.elasticsearch.common.joda.time.format.PeriodFormatter;
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.StreamOutput;
-import org.elasticsearch.util.io.stream.Streamable;
 
 import java.io.IOException;
 import java.io.Serializable;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/AbstractFuture.java b/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/AbstractFuture.java
deleted file mode 100644
index ebc15d21d22..00000000000
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/AbstractFuture.java
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * Licensed to Elastic Search and Shay Banon under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. Elastic Search 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.
- */
-
-package org.elasticsearch.util.concurrent;
-
-import java.util.concurrent.*;
-import java.util.concurrent.locks.AbstractQueuedSynchronizer;
-
-/**
- * 

An abstract implementation of the {@link Future} interface. This class - * is an abstraction of {@link java.util.concurrent.FutureTask} to support use - * for tasks other than {@link Runnable}s. It uses an - * {@link AbstractQueuedSynchronizer} to deal with concurrency issues and - * guarantee thread safety. It could be used as a base class to - * {@code FutureTask}, or any other implementor of the {@code Future} interface. - * - *

This class implements all methods in {@code Future}. Subclasses should - * provide a way to set the result of the computation through the protected - * methods {@link #set(Object)}, {@link #setException(Throwable)}, or - * {@link #cancel()}. If subclasses want to implement cancellation they can - * override the {@link #cancel(boolean)} method with a real implementation, the - * default implementation doesn't support cancellation. - * - *

The state changing methods all return a boolean indicating success or - * failure in changing the future's state. Valid states are running, - * completed, failed, or cancelled. Because this class does not implement - * cancellation it is left to the subclass to distinguish between created - * and running tasks. - */ -public abstract class AbstractFuture implements Future { - - /** - * Synchronization control for AbstractFutures. - */ - private final Sync sync = new Sync(); - - /* - * Blocks until either the task completes or the timeout expires. Uses the - * sync blocking-with-timeout support provided by AQS. - */ - - public V get(long timeout, TimeUnit unit) throws InterruptedException, - TimeoutException, ExecutionException { - return sync.get(unit.toNanos(timeout)); - } - - /* - * Blocks until the task completes or we get interrupted. Uses the - * interruptible blocking support provided by AQS. - */ - - public V get() throws InterruptedException, ExecutionException { - return sync.get(); - } - - /* - * Checks if the sync is not in the running state. - */ - - public boolean isDone() { - return sync.isDone(); - } - - /* - * Checks if the sync is in the cancelled state. - */ - - public boolean isCancelled() { - return sync.isCancelled(); - } - - /* - * Default implementation of cancel that never cancels the future. - * Subclasses should override this to implement cancellation if desired. - */ - - public boolean cancel(boolean mayInterruptIfRunning) { - return false; - } - - /** - * Subclasses should invoke this method to set the result of the computation - * to {@code value}. This will set the state of the future to - * {@link AbstractFuture.Sync#COMPLETED} and call {@link #done()} if the - * state was successfully changed. - * - * @param value the value that was the result of the task. - * @return true if the state was successfully changed. - */ - protected boolean set(V value) { - boolean result = sync.set(value); - if (result) { - done(); - } - return result; - } - - /** - * Subclasses should invoke this method to set the result of the computation - * to an error, {@code throwable}. This will set the state of the future to - * {@link AbstractFuture.Sync#COMPLETED} and call {@link #done()} if the - * state was successfully changed. - * - * @param throwable the exception that the task failed with. - * @return true if the state was successfully changed. - * @throws Error if the throwable was an {@link Error}. - */ - protected boolean setException(Throwable throwable) { - boolean result = sync.setException(throwable); - if (result) { - done(); - } - - // If it's an Error, we want to make sure it reaches the top of the - // call stack, so we rethrow it. - if (throwable instanceof Error) { - throw (Error) throwable; - } - return result; - } - - /** - * Subclasses should invoke this method to mark the future as cancelled. - * This will set the state of the future to {@link - * AbstractFuture.Sync#CANCELLED} and call {@link #done()} if the state was - * successfully changed. - * - * @return true if the state was successfully changed. - */ - protected final boolean cancel() { - boolean result = sync.cancel(); - if (result) { - done(); - } - return result; - } - - /* - * Called by the success, failed, or cancelled methods to indicate that the - * value is now available and the latch can be released. Subclasses can - * use this method to deal with any actions that should be undertaken when - * the task has completed. - */ - - protected void done() { - // Default implementation does nothing. - } - - /** - *

Following the contract of {@link AbstractQueuedSynchronizer} we create a - * private subclass to hold the synchronizer. This synchronizer is used to - * implement the blocking and waiting calls as well as to handle state changes - * in a thread-safe manner. The current state of the future is held in the - * Sync state, and the lock is released whenever the state changes to either - * {@link #COMPLETED} or {@link #CANCELLED}. - * - *

To avoid races between threads doing release and acquire, we transition - * to the final state in two steps. One thread will successfully CAS from - * RUNNING to COMPLETING, that thread will then set the result of the - * computation, and only then transition to COMPLETED or CANCELLED. - * - *

We don't use the integer argument passed between acquire methods so we - * pass around a -1 everywhere. - */ - static final class Sync extends AbstractQueuedSynchronizer { - - private static final long serialVersionUID = 0L; - - /* Valid states. */ - static final int RUNNING = 0; - static final int COMPLETING = 1; - static final int COMPLETED = 2; - static final int CANCELLED = 4; - - private V value; - private ExecutionException exception; - - /* - * Acquisition succeeds if the future is done, otherwise it fails. - */ - - @Override - protected int tryAcquireShared(int ignored) { - if (isDone()) { - return 1; - } - return -1; - } - - /* - * We always allow a release to go through, this means the state has been - * successfully changed and the result is available. - */ - - @Override - protected boolean tryReleaseShared(int finalState) { - setState(finalState); - return true; - } - - /** - * Blocks until the task is complete or the timeout expires. Throws a - * {@link TimeoutException} if the timer expires, otherwise behaves like - * {@link #get()}. - */ - V get(long nanos) throws TimeoutException, CancellationException, - ExecutionException, InterruptedException { - - // Attempt to acquire the shared lock with a timeout. - if (!tryAcquireSharedNanos(-1, nanos)) { - throw new TimeoutException("Timeout waiting for task."); - } - - return getValue(); - } - - /** - * Blocks until {@link #complete(Object, Throwable, int)} has been - * successfully called. Throws a {@link CancellationException} if the task - * was cancelled, or a {@link ExecutionException} if the task completed with - * an error. - */ - V get() throws CancellationException, ExecutionException, - InterruptedException { - - // Acquire the shared lock allowing interruption. - acquireSharedInterruptibly(-1); - return getValue(); - } - - /** - * Implementation of the actual value retrieval. Will return the value - * on success, an exception on failure, a cancellation on cancellation, or - * an illegal state if the synchronizer is in an invalid state. - */ - private V getValue() throws CancellationException, ExecutionException { - int state = getState(); - switch (state) { - case COMPLETED: - if (exception != null) { - throw exception; - } else { - return value; - } - - case CANCELLED: - throw new CancellationException("Task was cancelled."); - - default: - throw new IllegalStateException( - "Error, synchronizer in invalid state: " + state); - } - } - - /** - * Checks if the state is {@link #COMPLETED} or {@link #CANCELLED}. - */ - boolean isDone() { - return (getState() & (COMPLETED | CANCELLED)) != 0; - } - - /** - * Checks if the state is {@link #CANCELLED}. - */ - boolean isCancelled() { - return getState() == CANCELLED; - } - - /** - * Transition to the COMPLETED state and set the value. - */ - boolean set(V v) { - return complete(v, null, COMPLETED); - } - - /** - * Transition to the COMPLETED state and set the exception. - */ - boolean setException(Throwable t) { - return complete(null, t, COMPLETED); - } - - /** - * Transition to the CANCELLED state. - */ - boolean cancel() { - return complete(null, null, CANCELLED); - } - - /** - * Implementation of completing a task. Either {@code v} or {@code t} will - * be set but not both. The {@code finalState} is the state to change to - * from {@link #RUNNING}. If the state is not in the RUNNING state we - * return {@code false}. - * - * @param v the value to set as the result of the computation. - * @param t the exception to set as the result of the computation. - * @param finalState the state to transition to. - */ - private boolean complete(V v, Throwable t, int finalState) { - if (compareAndSetState(RUNNING, COMPLETING)) { - this.value = v; - this.exception = t == null ? null : new ExecutionException(t); - releaseShared(finalState); - return true; - } - - // The state was not RUNNING, so there are no valid transitions. - return false; - } - } -} diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/Futures.java b/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/Futures.java deleted file mode 100644 index 9fb24f7ac72..00000000000 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/Futures.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to Elastic Search and Shay Banon under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. Elastic Search 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. - */ - -package org.elasticsearch.util.concurrent; - -import org.elasticsearch.ElasticSearchException; -import org.elasticsearch.ElasticSearchInterruptedException; - -import java.util.concurrent.ExecutionException; - -/** - * @author kimchy (Shay Banon) - */ -public class Futures { - - public static ElasticSearchException convert(Exception e) { - if (e instanceof ExecutionException) { - if (e.getCause() instanceof ElasticSearchException) { - return (ElasticSearchException) e.getCause(); - } - return new UncategorizedExecutionException(e.getCause().getMessage(), e.getCause()); - } - if (e instanceof InterruptedException) { - return new ElasticSearchInterruptedException(e.getMessage(), e.getCause()); - } - if (e instanceof ElasticSearchException) { - return (ElasticSearchException) e; - } - return new UncategorizedExecutionException(e.getMessage(), e); - } - - private Futures() { - - } -} diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/GuardedBy.java b/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/GuardedBy.java deleted file mode 100644 index dfa615a1aca..00000000000 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/GuardedBy.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to Elastic Search and Shay Banon under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. Elastic Search 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. - */ - -package org.elasticsearch.util.concurrent; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * GuardedBy - *

- * The field or method to which this annotation is applied can only be accessed - * when holding a particular lock, which may be a built-in (synchronization) - * lock, or may be an explicit java.util.concurrent.Lock. - *

- * The argument determines which lock guards the annotated field or method: this : - * The string literal "this" means that this field is guarded by the class in - * which it is defined. class-name.this : For inner classes, it may be necessary - * to disambiguate 'this'; the class-name.this designation allows you to specify - * which 'this' reference is intended itself : For reference fields only; the - * object to which the field refers. field-name : The lock object is referenced - * by the (instance or static) field specified by field-name. - * class-name.field-name : The lock object is reference by the static field - * specified by class-name.field-name. method-name() : The lock object is - * returned by calling the named nil-ary method. class-name.class : The Class - * object for the specified class should be used as the lock object. - * - * @author kimchy (Shay Banon) - */ -@Target({ElementType.FIELD, ElementType.METHOD}) -@Retention(RetentionPolicy.CLASS) -public @interface GuardedBy { - String value(); -} \ No newline at end of file diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/ForkJoinPool.java b/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/ForkJoinPool.java deleted file mode 100644 index 3e6820d3bd3..00000000000 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/ForkJoinPool.java +++ /dev/null @@ -1,1970 +0,0 @@ -/* - * Licensed to Elastic Search and Shay Banon under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. Elastic Search 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. - */ - -/* - * Written by Doug Lea with assistance from members of JCP JSR-166 - * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain - */ - -package org.elasticsearch.util.concurrent.jsr166y; - -import java.util.*; -import java.util.concurrent.*; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.locks.LockSupport; -import java.util.concurrent.locks.ReentrantLock; - -/** - * An {@link ExecutorService} for running {@link ForkJoinTask}s. - * A {@code ForkJoinPool} provides the entry point for submissions - * from non-{@code ForkJoinTask}s, as well as management and - * monitoring operations. - * - *

A {@code ForkJoinPool} differs from other kinds of {@link - * ExecutorService} mainly by virtue of employing - * work-stealing: all threads in the pool attempt to find and - * execute subtasks created by other active tasks (eventually blocking - * waiting for work if none exist). This enables efficient processing - * when most tasks spawn other subtasks (as do most {@code - * ForkJoinTask}s). A {@code ForkJoinPool} may also be used for mixed - * execution of some plain {@code Runnable}- or {@code Callable}- - * based activities along with {@code ForkJoinTask}s. When setting - * {@linkplain #setAsyncMode async mode}, a {@code ForkJoinPool} may - * also be appropriate for use with fine-grained tasks of any form - * that are never joined. Otherwise, other {@code ExecutorService} - * implementations are typically more appropriate choices. - * - *

A {@code ForkJoinPool} is constructed with a given target - * parallelism level; by default, equal to the number of available - * processors. Unless configured otherwise via {@link - * #setMaintainsParallelism}, the pool attempts to maintain this - * number of active (or available) threads by dynamically adding, - * suspending, or resuming internal worker threads, even if some tasks - * are stalled waiting to join others. However, no such adjustments - * are performed in the face of blocked IO or other unmanaged - * synchronization. The nested {@link ManagedBlocker} interface - * enables extension of the kinds of synchronization accommodated. - * The target parallelism level may also be changed dynamically - * ({@link #setParallelism}). The total number of threads may be - * limited using method {@link #setMaximumPoolSize}, in which case it - * may become possible for the activities of a pool to stall due to - * the lack of available threads to process new tasks. When the pool - * is executing tasks, these and other configuration setting methods - * may only gradually affect actual pool sizes. It is normally best - * practice to invoke these methods only when the pool is known to be - * quiescent. - * - *

In addition to execution and lifecycle control methods, this - * class provides status check methods (for example - * {@link #getStealCount}) that are intended to aid in developing, - * tuning, and monitoring fork/join applications. Also, method - * {@link #toString} returns indications of pool state in a - * convenient form for informal monitoring. - * - *

Sample Usage. Normally a single {@code ForkJoinPool} is - * used for all parallel task execution in a program or subsystem. - * Otherwise, use would not usually outweigh the construction and - * bookkeeping overhead of creating a large set of threads. For - * example, a common pool could be used for the {@code SortTasks} - * illustrated in {@link RecursiveAction}. Because {@code - * ForkJoinPool} uses threads in {@linkplain java.lang.Thread#isDaemon - * daemon} mode, there is typically no need to explicitly {@link - * #shutdown} such a pool upon program exit. - * - *

- * static final ForkJoinPool mainPool = new ForkJoinPool();
- * ...
- * public void sort(long[] array) {
- *   mainPool.invoke(new SortTask(array, 0, array.length));
- * }
- * 
- * - *

Implementation notes: This implementation restricts the - * maximum number of running threads to 32767. Attempts to create - * pools with greater than the maximum number result in - * {@code IllegalArgumentException}. - * - *

This implementation rejects submitted tasks (that is, by throwing - * {@link RejectedExecutionException}) only when the pool is shut down. - * - * @author Doug Lea - * @since 1.7 - */ -public class ForkJoinPool extends AbstractExecutorService { - - /* - * Implementation Overview - * - * This class provides the central bookkeeping and control for a - * set of worker threads: Submissions from non-FJ threads enter - * into a submission queue. Workers take these tasks and typically - * split them into subtasks that may be stolen by other workers. - * The main work-stealing mechanics implemented in class - * ForkJoinWorkerThread give first priority to processing tasks - * from their own queues (LIFO or FIFO, depending on mode), then - * to randomized FIFO steals of tasks in other worker queues, and - * lastly to new submissions. These mechanics do not consider - * affinities, loads, cache localities, etc, so rarely provide the - * best possible performance on a given machine, but portably - * provide good throughput by averaging over these factors. - * (Further, even if we did try to use such information, we do not - * usually have a basis for exploiting it. For example, some sets - * of tasks profit from cache affinities, but others are harmed by - * cache pollution effects.) - * - * The main throughput advantages of work-stealing stem from - * decentralized control -- workers mostly steal tasks from each - * other. We do not want to negate this by creating bottlenecks - * implementing the management responsibilities of this class. So - * we use a collection of techniques that avoid, reduce, or cope - * well with contention. These entail several instances of - * bit-packing into CASable fields to maintain only the minimally - * required atomicity. To enable such packing, we restrict maximum - * parallelism to (1<<15)-1 (enabling twice this to fit into a 16 - * bit field), which is far in excess of normal operating range. - * Even though updates to some of these bookkeeping fields do - * sometimes contend with each other, they don't normally - * cache-contend with updates to others enough to warrant memory - * padding or isolation. So they are all held as fields of - * ForkJoinPool objects. The main capabilities are as follows: - * - * 1. Creating and removing workers. Workers are recorded in the - * "workers" array. This is an array as opposed to some other data - * structure to support index-based random steals by workers. - * Updates to the array recording new workers and unrecording - * terminated ones are protected from each other by a lock - * (workerLock) but the array is otherwise concurrently readable, - * and accessed directly by workers. To simplify index-based - * operations, the array size is always a power of two, and all - * readers must tolerate null slots. Currently, all but the first - * worker thread creation is on-demand, triggered by task - * submissions, replacement of terminated workers, and/or - * compensation for blocked workers. However, all other support - * code is set up to work with other policies. - * - * 2. Bookkeeping for dynamically adding and removing workers. We - * maintain a given level of parallelism (or, if - * maintainsParallelism is false, at least avoid starvation). When - * some workers are known to be blocked (on joins or via - * ManagedBlocker), we may create or resume others to take their - * place until they unblock (see below). Implementing this - * requires counts of the number of "running" threads (i.e., those - * that are neither blocked nor artifically suspended) as well as - * the total number. These two values are packed into one field, - * "workerCounts" because we need accurate snapshots when deciding - * to create, resume or suspend. To support these decisions, - * updates must be prospective (not retrospective). For example, - * the running count is decremented before blocking by a thread - * about to block, but incremented by the thread about to unblock - * it. (In a few cases, these prospective updates may need to be - * rolled back, for example when deciding to create a new worker - * but the thread factory fails or returns null. In these cases, - * we are no worse off wrt other decisions than we would be - * otherwise.) Updates to the workerCounts field sometimes - * transiently encounter a fair amount of contention when join - * dependencies are such that many threads block or unblock at - * about the same time. We alleviate this by sometimes bundling - * updates (for example blocking one thread on join and resuming a - * spare cancel each other out), and in most other cases - * performing an alternative action (like releasing waiters and - * finding spares; see below) as a more productive form of - * backoff. - * - * 3. Maintaining global run state. The run state of the pool - * consists of a runLevel (SHUTDOWN, TERMINATING, etc) similar to - * those in other Executor implementations, as well as a count of - * "active" workers -- those that are, or soon will be, or - * recently were executing tasks. The runLevel and active count - * are packed together in order to correctly trigger shutdown and - * termination. Without care, active counts can be subject to very - * high contention. We substantially reduce this contention by - * relaxing update rules. A worker must claim active status - * prospectively, by activating if it sees that a submitted or - * stealable task exists (it may find after activating that the - * task no longer exists). It stays active while processing this - * task (if it exists) and any other local subtasks it produces, - * until it cannot find any other tasks. It then tries - * inactivating (see method preStep), but upon update contention - * instead scans for more tasks, later retrying inactivation if it - * doesn't find any. - * - * 4. Managing idle workers waiting for tasks. We cannot let - * workers spin indefinitely scanning for tasks when none are - * available. On the other hand, we must quickly prod them into - * action when new tasks are submitted or generated. We - * park/unpark these idle workers using an event-count scheme. - * Field eventCount is incremented upon events that may enable - * workers that previously could not find a task to now find one: - * Submission of a new task to the pool, or another worker pushing - * a task onto a previously empty queue. (We also use this - * mechanism for termination and reconfiguration actions that - * require wakeups of idle workers). Each worker maintains its - * last known event count, and blocks when a scan for work did not - * find a task AND its lastEventCount matches the current - * eventCount. Waiting idle workers are recorded in a variant of - * Treiber stack headed by field eventWaiters which, when nonzero, - * encodes the thread index and count awaited for by the worker - * thread most recently calling eventSync. This thread in turn has - * a record (field nextEventWaiter) for the next waiting worker. - * In addition to allowing simpler decisions about need for - * wakeup, the event count bits in eventWaiters serve the role of - * tags to avoid ABA errors in Treiber stacks. To reduce delays - * in task diffusion, workers not otherwise occupied may invoke - * method releaseWaiters, that removes and signals (unparks) - * workers not waiting on current count. To minimize task - * production stalls associate with signalling, any worker pushing - * a task on an empty queue invokes the weaker method signalWork, - * that only releases idle workers until it detects interference - * by other threads trying to release, and lets them take - * over. The net effect is a tree-like diffusion of signals, where - * released threads and possibly others) help with unparks. To - * further reduce contention effects a bit, failed CASes to - * increment field eventCount are tolerated without retries. - * Conceptually they are merged into the same event, which is OK - * when their only purpose is to enable workers to scan for work. - * - * 5. Managing suspension of extra workers. When a worker is about - * to block waiting for a join (or via ManagedBlockers), we may - * create a new thread to maintain parallelism level, or at least - * avoid starvation (see below). Usually, extra threads are needed - * for only very short periods, yet join dependencies are such - * that we sometimes need them in bursts. Rather than create new - * threads each time this happens, we suspend no-longer-needed - * extra ones as "spares". For most purposes, we don't distinguish - * "extra" spare threads from normal "core" threads: On each call - * to preStep (the only point at which we can do this) a worker - * checks to see if there are now too many running workers, and if - * so, suspends itself. Methods preJoin and doBlock look for - * suspended threads to resume before considering creating a new - * replacement. We don't need a special data structure to maintain - * spares; simply scanning the workers array looking for - * worker.isSuspended() is fine because the calling thread is - * otherwise not doing anything useful anyway; we are at least as - * happy if after locating a spare, the caller doesn't actually - * block because the join is ready before we try to adjust and - * compensate. Note that this is intrinsically racy. One thread - * may become a spare at about the same time as another is - * needlessly being created. We counteract this and related slop - * in part by requiring resumed spares to immediately recheck (in - * preStep) to see whether they they should re-suspend. The only - * effective difference between "extra" and "core" threads is that - * we allow the "extra" ones to time out and die if they are not - * resumed within a keep-alive interval of a few seconds. This is - * implemented mainly within ForkJoinWorkerThread, but requires - * some coordination (isTrimmed() -- meaning killed while - * suspended) to correctly maintain pool counts. - * - * 6. Deciding when to create new workers. The main dynamic - * control in this class is deciding when to create extra threads, - * in methods preJoin and doBlock. We always need to create one - * when the number of running threads becomes zero. But because - * blocked joins are typically dependent, we don't necessarily - * need or want one-to-one replacement. Using a one-to-one - * compensation rule often leads to enough useless overhead - * creating, suspending, resuming, and/or killing threads to - * signficantly degrade throughput. We use a rule reflecting the - * idea that, the more spare threads you already have, the more - * evidence you need to create another one; where "evidence" is - * expressed as the current deficit -- target minus running - * threads. To reduce flickering and drift around target values, - * the relation is quadratic: adding a spare if (dc*dc)>=(sc*pc) - * (where dc is deficit, sc is number of spare threads and pc is - * target parallelism.) This effectively reduces churn at the - * price of systematically undershooting target parallelism when - * many threads are blocked. However, biasing toward undeshooting - * partially compensates for the above mechanics to suspend extra - * threads, that normally lead to overshoot because we can only - * suspend workers in-between top-level actions. It also better - * copes with the fact that some of the methods in this class tend - * to never become compiled (but are interpreted), so some - * components of the entire set of controls might execute many - * times faster than others. And similarly for cases where the - * apparent lack of work is just due to GC stalls and other - * transient system activity. - * - * 7. Maintaining other configuration parameters and monitoring - * statistics. Updates to fields controlling parallelism level, - * max size, etc can only meaningfully take effect for individual - * threads upon their next top-level actions; i.e., between - * stealing/running tasks/submission, which are separated by calls - * to preStep. Memory ordering for these (assumed infrequent) - * reconfiguration calls is ensured by using reads and writes to - * volatile field workerCounts (that must be read in preStep anyway) - * as "fences" -- user-level reads are preceded by reads of - * workCounts, and writes are followed by no-op CAS to - * workerCounts. The values reported by other management and - * monitoring methods are either computed on demand, or are kept - * in fields that are only updated when threads are otherwise - * idle. - * - * Beware that there is a lot of representation-level coupling - * among classes ForkJoinPool, ForkJoinWorkerThread, and - * ForkJoinTask. For example, direct access to "workers" array by - * workers, and direct access to ForkJoinTask.status by both - * ForkJoinPool and ForkJoinWorkerThread. There is little point - * trying to reduce this, since any associated future changes in - * representations will need to be accompanied by algorithmic - * changes anyway. - * - * Style notes: There are lots of inline assignments (of form - * "while ((local = field) != 0)") which are usually the simplest - * way to ensure read orderings. Also several occurrences of the - * unusual "do {} while(!cas...)" which is the simplest way to - * force an update of a CAS'ed variable. There are also a few - * other coding oddities that help some methods perform reasonably - * even when interpreted (not compiled). - * - * The order of declarations in this file is: (1) statics (2) - * fields (along with constants used when unpacking some of them) - * (3) internal control methods (4) callbacks and other support - * for ForkJoinTask and ForkJoinWorkerThread classes, (5) exported - * methods (plus a few little helpers). - */ - - /** - * Factory for creating new {@link ForkJoinWorkerThread}s. - * A {@code ForkJoinWorkerThreadFactory} must be defined and used - * for {@code ForkJoinWorkerThread} subclasses that extend base - * functionality or initialize threads with different contexts. - */ - public static interface ForkJoinWorkerThreadFactory { - /** - * Returns a new worker thread operating in the given pool. - * - * @param pool the pool this thread works in - * @throws NullPointerException if the pool is null - */ - public ForkJoinWorkerThread newThread(ForkJoinPool pool); - } - - /** - * Default ForkJoinWorkerThreadFactory implementation; creates a - * new ForkJoinWorkerThread. - */ - static class DefaultForkJoinWorkerThreadFactory - implements ForkJoinWorkerThreadFactory { - public ForkJoinWorkerThread newThread(ForkJoinPool pool) { - return new ForkJoinWorkerThread(pool); - } - } - - /** - * Creates a new ForkJoinWorkerThread. This factory is used unless - * overridden in ForkJoinPool constructors. - */ - public static final ForkJoinWorkerThreadFactory - defaultForkJoinWorkerThreadFactory = - new DefaultForkJoinWorkerThreadFactory(); - - /** - * Permission required for callers of methods that may start or - * kill threads. - */ - private static final RuntimePermission modifyThreadPermission = - new RuntimePermission("modifyThread"); - - /** - * If there is a security manager, makes sure caller has - * permission to modify threads. - */ - private static void checkPermission() { - SecurityManager security = System.getSecurityManager(); - if (security != null) - security.checkPermission(modifyThreadPermission); - } - - /** - * Generator for assigning sequence numbers as pool names. - */ - private static final AtomicInteger poolNumberGenerator = - new AtomicInteger(); - - /** - * Absolute bound for parallelism level. Twice this number must - * fit into a 16bit field to enable word-packing for some counts. - */ - private static final int MAX_THREADS = 0x7fff; - - /** - * Array holding all worker threads in the pool. Array size must - * be a power of two. Updates and replacements are protected by - * workerLock, but the array is always kept in a consistent enough - * state to be randomly accessed without locking by workers - * performing work-stealing, as well as other traversal-based - * methods in this class. All readers must tolerate that some - * array slots may be null. - */ - volatile ForkJoinWorkerThread[] workers; - - /** - * Queue for external submissions. - */ - private final LinkedTransferQueue> submissionQueue; - - /** - * Lock protecting updates to workers array. - */ - private final ReentrantLock workerLock; - - /** - * Latch released upon termination. - */ - private final CountDownLatch terminationLatch; - - /** - * Creation factory for worker threads. - */ - private final ForkJoinWorkerThreadFactory factory; - - /** - * Sum of per-thread steal counts, updated only when threads are - * idle or terminating. - */ - private volatile long stealCount; - - /** - * Encoded record of top of treiber stack of threads waiting for - * events. The top 32 bits contain the count being waited for. The - * bottom word contains one plus the pool index of waiting worker - * thread. - */ - private volatile long eventWaiters; - - private static final int EVENT_COUNT_SHIFT = 32; - private static final long WAITER_INDEX_MASK = (1L << EVENT_COUNT_SHIFT) - 1L; - - /** - * A counter for events that may wake up worker threads: - * - Submission of a new task to the pool - * - A worker pushing a task on an empty queue - * - termination and reconfiguration - */ - private volatile int eventCount; - - /** - * Lifecycle control. The low word contains the number of workers - * that are (probably) executing tasks. This value is atomically - * incremented before a worker gets a task to run, and decremented - * when worker has no tasks and cannot find any. Bits 16-18 - * contain runLevel value. When all are zero, the pool is - * running. Level transitions are monotonic (running -> shutdown - * -> terminating -> terminated) so each transition adds a bit. - * These are bundled together to ensure consistent read for - * termination checks (i.e., that runLevel is at least SHUTDOWN - * and active threads is zero). - */ - private volatile int runState; - - // Note: The order among run level values matters. - private static final int RUNLEVEL_SHIFT = 16; - private static final int SHUTDOWN = 1 << RUNLEVEL_SHIFT; - private static final int TERMINATING = 1 << (RUNLEVEL_SHIFT + 1); - private static final int TERMINATED = 1 << (RUNLEVEL_SHIFT + 2); - private static final int ACTIVE_COUNT_MASK = (1 << RUNLEVEL_SHIFT) - 1; - private static final int ONE_ACTIVE = 1; // active update delta - - /** - * Holds number of total (i.e., created and not yet terminated) - * and running (i.e., not blocked on joins or other managed sync) - * threads, packed together to ensure consistent snapshot when - * making decisions about creating and suspending spare - * threads. Updated only by CAS. Note that adding a new worker - * requires incrementing both counts, since workers start off in - * running state. This field is also used for memory-fencing - * configuration parameters. - */ - private volatile int workerCounts; - - private static final int TOTAL_COUNT_SHIFT = 16; - private static final int RUNNING_COUNT_MASK = (1 << TOTAL_COUNT_SHIFT) - 1; - private static final int ONE_RUNNING = 1; - private static final int ONE_TOTAL = 1 << TOTAL_COUNT_SHIFT; - - /* - * Fields parallelism. maxPoolSize, locallyFifo, - * maintainsParallelism, and ueh are non-volatile, but external - * reads/writes use workerCount fences to ensure visability. - */ - - /** - * The target parallelism level. - */ - private int parallelism; - - /** - * The maximum allowed pool size. - */ - private int maxPoolSize; - - /** - * True if use local fifo, not default lifo, for local polling - * Replicated by ForkJoinWorkerThreads - */ - private boolean locallyFifo; - - /** - * Controls whether to add spares to maintain parallelism - */ - private boolean maintainsParallelism; - - /** - * The uncaught exception handler used when any worker - * abruptly terminates - */ - private Thread.UncaughtExceptionHandler ueh; - - /** - * Pool number, just for assigning useful names to worker threads - */ - private final int poolNumber; - - // utilities for updating fields - - /** - * Adds delta to running count. Used mainly by ForkJoinTask. - * - * @param delta the number to add - */ - final void updateRunningCount(int delta) { - int wc; - do { - } while (!UNSAFE.compareAndSwapInt(this, workerCountsOffset, - wc = workerCounts, - wc + delta)); - } - - /** - * Write fence for user modifications of pool parameters - * (parallelism. etc). Note that it doesn't matter if CAS fails. - */ - private void workerCountWriteFence() { - int wc; - UNSAFE.compareAndSwapInt(this, workerCountsOffset, - wc = workerCounts, wc); - } - - /** - * Read fence for external reads of pool parameters - * (parallelism. maxPoolSize, etc). - */ - private void workerCountReadFence() { - int ignore = workerCounts; - } - - /** - * Tries incrementing active count; fails on contention. - * Called by workers before executing tasks. - * - * @return true on success - */ - final boolean tryIncrementActiveCount() { - int c; - return UNSAFE.compareAndSwapInt(this, runStateOffset, - c = runState, c + ONE_ACTIVE); - } - - /** - * Tries decrementing active count; fails on contention. - * Called when workers cannot find tasks to run. - */ - final boolean tryDecrementActiveCount() { - int c; - return UNSAFE.compareAndSwapInt(this, runStateOffset, - c = runState, c - ONE_ACTIVE); - } - - /** - * Advances to at least the given level. Returns true if not - * already in at least the given level. - */ - private boolean advanceRunLevel(int level) { - for (; ;) { - int s = runState; - if ((s & level) != 0) - return false; - if (UNSAFE.compareAndSwapInt(this, runStateOffset, s, s | level)) - return true; - } - } - - // workers array maintenance - - /** - * Records and returns a workers array index for new worker. - */ - private int recordWorker(ForkJoinWorkerThread w) { - // Try using slot totalCount-1. If not available, scan and/or resize - int k = (workerCounts >>> TOTAL_COUNT_SHIFT) - 1; - final ReentrantLock lock = this.workerLock; - lock.lock(); - try { - ForkJoinWorkerThread[] ws = workers; - int len = ws.length; - if (k < 0 || k >= len || ws[k] != null) { - for (k = 0; k < len && ws[k] != null; ++k) - ; - if (k == len) - ws = Arrays.copyOf(ws, len << 1); - } - ws[k] = w; - workers = ws; // volatile array write ensures slot visibility - } finally { - lock.unlock(); - } - return k; - } - - /** - * Nulls out record of worker in workers array - */ - private void forgetWorker(ForkJoinWorkerThread w) { - int idx = w.poolIndex; - // Locking helps method recordWorker avoid unecessary expansion - final ReentrantLock lock = this.workerLock; - lock.lock(); - try { - ForkJoinWorkerThread[] ws = workers; - if (idx >= 0 && idx < ws.length && ws[idx] == w) // verify - ws[idx] = null; - } finally { - lock.unlock(); - } - } - - // adding and removing workers - - /** - * Tries to create and add new worker. Assumes that worker counts - * are already updated to accommodate the worker, so adjusts on - * failure. - * - * @return new worker or null if creation failed - */ - private ForkJoinWorkerThread addWorker() { - ForkJoinWorkerThread w = null; - try { - w = factory.newThread(this); - } finally { // Adjust on either null or exceptional factory return - if (w == null) { - onWorkerCreationFailure(); - return null; - } - } - w.start(recordWorker(w), locallyFifo, ueh); - return w; - } - - /** - * Adjusts counts upon failure to create worker - */ - private void onWorkerCreationFailure() { - int c; - do { - } while (!UNSAFE.compareAndSwapInt(this, workerCountsOffset, - c = workerCounts, - c - (ONE_RUNNING | ONE_TOTAL))); - tryTerminate(false); // in case of failure during shutdown - } - - /** - * Create enough total workers to establish target parallelism, - * giving up if terminating or addWorker fails - */ - private void ensureEnoughTotalWorkers() { - int wc; - while (runState < TERMINATING && - ((wc = workerCounts) >>> TOTAL_COUNT_SHIFT) < parallelism) { - if ((UNSAFE.compareAndSwapInt(this, workerCountsOffset, - wc, wc + (ONE_RUNNING | ONE_TOTAL)) && - addWorker() == null)) - break; - } - } - - /** - * Final callback from terminating worker. Removes record of - * worker from array, and adjusts counts. If pool is shutting - * down, tries to complete terminatation, else possibly replaces - * the worker. - * - * @param w the worker - */ - final void workerTerminated(ForkJoinWorkerThread w) { - if (w.active) { // force inactive - w.active = false; - do { - } while (!tryDecrementActiveCount()); - } - forgetWorker(w); - - // decrement total count, and if was running, running count - int unit = w.isTrimmed() ? ONE_TOTAL : (ONE_RUNNING | ONE_TOTAL); - int wc; - do { - } while (!UNSAFE.compareAndSwapInt(this, workerCountsOffset, - wc = workerCounts, wc - unit)); - - accumulateStealCount(w); // collect final count - if (!tryTerminate(false)) - ensureEnoughTotalWorkers(); - } - - // Waiting for and signalling events - - /** - * Ensures eventCount on exit is different (mod 2^32) than on - * entry. CAS failures are OK -- any change in count suffices. - */ - private void advanceEventCount() { - int c; - UNSAFE.compareAndSwapInt(this, eventCountOffset, c = eventCount, c + 1); - } - - /** - * Releases workers blocked on a count not equal to current count. - */ - final void releaseWaiters() { - long top; - int id; - while ((id = (int) ((top = eventWaiters) & WAITER_INDEX_MASK)) > 0 && - (int) (top >>> EVENT_COUNT_SHIFT) != eventCount) { - ForkJoinWorkerThread[] ws = workers; - ForkJoinWorkerThread w; - if (ws.length >= id && (w = ws[id - 1]) != null && - UNSAFE.compareAndSwapLong(this, eventWaitersOffset, - top, w.nextWaiter)) - LockSupport.unpark(w); - } - } - - /** - * Advances eventCount and releases waiters until interference by - * other releasing threads is detected. - */ - final void signalWork() { - int ec; - UNSAFE.compareAndSwapInt(this, eventCountOffset, ec = eventCount, ec + 1); - outer: - for (; ;) { - long top = eventWaiters; - ec = eventCount; - for (; ;) { - ForkJoinWorkerThread[] ws; - ForkJoinWorkerThread w; - int id = (int) (top & WAITER_INDEX_MASK); - if (id <= 0 || (int) (top >>> EVENT_COUNT_SHIFT) == ec) - return; - if ((ws = workers).length < id || (w = ws[id - 1]) == null || - !UNSAFE.compareAndSwapLong(this, eventWaitersOffset, - top, top = w.nextWaiter)) - continue outer; // possibly stale; reread - LockSupport.unpark(w); - if (top != eventWaiters) // let someone else take over - return; - } - } - } - - /** - * If worker is inactive, blocks until terminating or event count - * advances from last value held by worker; in any case helps - * release others. - * - * @param w the calling worker thread - */ - private void eventSync(ForkJoinWorkerThread w) { - if (!w.active) { - int prev = w.lastEventCount; - long nextTop = (((long) prev << EVENT_COUNT_SHIFT) | - ((long) (w.poolIndex + 1))); - long top; - while ((runState < SHUTDOWN || !tryTerminate(false)) && - (((int) (top = eventWaiters) & WAITER_INDEX_MASK) == 0 || - (int) (top >>> EVENT_COUNT_SHIFT) == prev) && - eventCount == prev) { - if (UNSAFE.compareAndSwapLong(this, eventWaitersOffset, - w.nextWaiter = top, nextTop)) { - accumulateStealCount(w); // transfer steals while idle - Thread.interrupted(); // clear/ignore interrupt - while (eventCount == prev) - w.doPark(); - break; - } - } - w.lastEventCount = eventCount; - } - releaseWaiters(); - } - - /** - * Callback from workers invoked upon each top-level action (i.e., - * stealing a task or taking a submission and running - * it). Performs one or both of the following: - * - * * If the worker cannot find work, updates its active status to - * inactive and updates activeCount unless there is contention, in - * which case it may try again (either in this or a subsequent - * call). Additionally, awaits the next task event and/or helps - * wake up other releasable waiters. - * - * * If there are too many running threads, suspends this worker - * (first forcing inactivation if necessary). If it is not - * resumed before a keepAlive elapses, the worker may be "trimmed" - * -- killed while suspended within suspendAsSpare. Otherwise, - * upon resume it rechecks to make sure that it is still needed. - * - * @param w the worker - * @param worked false if the worker scanned for work but didn't - * find any (in which case it may block waiting for work). - */ - final void preStep(ForkJoinWorkerThread w, boolean worked) { - boolean active = w.active; - boolean inactivate = !worked & active; - for (; ;) { - if (inactivate) { - int c = runState; - if (UNSAFE.compareAndSwapInt(this, runStateOffset, - c, c - ONE_ACTIVE)) - inactivate = active = w.active = false; - } - int wc = workerCounts; - if ((wc & RUNNING_COUNT_MASK) <= parallelism) { - if (!worked) - eventSync(w); - return; - } - if (!(inactivate |= active) && // must inactivate to suspend - UNSAFE.compareAndSwapInt(this, workerCountsOffset, - wc, wc - ONE_RUNNING) && - !w.suspendAsSpare()) // false if trimmed - return; - } - } - - /** - * Adjusts counts and creates or resumes compensating threads for - * a worker about to block on task joinMe, returning early if - * joinMe becomes ready. First tries resuming an existing spare - * (which usually also avoids any count adjustment), but must then - * decrement running count to determine whether a new thread is - * needed. See above for fuller explanation. - */ - final void preJoin(ForkJoinTask joinMe) { - boolean dec = false; // true when running count decremented - for (; ;) { - releaseWaiters(); // help other threads progress - - if (joinMe.status < 0) // surround spare search with done checks - return; - ForkJoinWorkerThread spare = null; - for (ForkJoinWorkerThread w : workers) { - if (w != null && w.isSuspended()) { - spare = w; - break; - } - } - if (joinMe.status < 0) - return; - - if (spare != null && spare.tryUnsuspend()) { - if (dec || joinMe.requestSignal() < 0) { - int c; - do { - } while (!UNSAFE.compareAndSwapInt(this, - workerCountsOffset, - c = workerCounts, - c + ONE_RUNNING)); - } // else no net count change - LockSupport.unpark(spare); - return; - } - - int wc = workerCounts; // decrement running count - if (!dec && (wc & RUNNING_COUNT_MASK) != 0 && - (dec = UNSAFE.compareAndSwapInt(this, workerCountsOffset, - wc, wc -= ONE_RUNNING)) && - joinMe.requestSignal() < 0) { // cannot block - int c; // back out - do { - } while (!UNSAFE.compareAndSwapInt(this, - workerCountsOffset, - c = workerCounts, - c + ONE_RUNNING)); - return; - } - - if (dec) { - int tc = wc >>> TOTAL_COUNT_SHIFT; - int pc = parallelism; - int dc = pc - (wc & RUNNING_COUNT_MASK); // deficit count - if ((dc < pc && (dc <= 0 || (dc * dc < (tc - pc) * pc) || - !maintainsParallelism)) || - tc >= maxPoolSize) // cannot add - return; - if (spare == null && - UNSAFE.compareAndSwapInt(this, workerCountsOffset, wc, - wc + (ONE_RUNNING | ONE_TOTAL))) { - addWorker(); - return; - } - } - } - } - - /** - * Same idea as preJoin but with too many differing details to - * integrate: There are no task-based signal counts, and only one - * way to do the actual blocking. So for simplicity it is directly - * incorporated into this method. - */ - final void doBlock(ManagedBlocker blocker, boolean maintainPar) - throws InterruptedException { - maintainPar &= maintainsParallelism; // override - boolean dec = false; - boolean done = false; - for (; ;) { - releaseWaiters(); - if (done = blocker.isReleasable()) - break; - ForkJoinWorkerThread spare = null; - for (ForkJoinWorkerThread w : workers) { - if (w != null && w.isSuspended()) { - spare = w; - break; - } - } - if (done = blocker.isReleasable()) - break; - if (spare != null && spare.tryUnsuspend()) { - if (dec) { - int c; - do { - } while (!UNSAFE.compareAndSwapInt(this, - workerCountsOffset, - c = workerCounts, - c + ONE_RUNNING)); - } - LockSupport.unpark(spare); - break; - } - int wc = workerCounts; - if (!dec && (wc & RUNNING_COUNT_MASK) != 0) - dec = UNSAFE.compareAndSwapInt(this, workerCountsOffset, - wc, wc -= ONE_RUNNING); - if (dec) { - int tc = wc >>> TOTAL_COUNT_SHIFT; - int pc = parallelism; - int dc = pc - (wc & RUNNING_COUNT_MASK); - if ((dc < pc && (dc <= 0 || (dc * dc < (tc - pc) * pc) || - !maintainPar)) || - tc >= maxPoolSize) - break; - if (spare == null && - UNSAFE.compareAndSwapInt(this, workerCountsOffset, wc, - wc + (ONE_RUNNING | ONE_TOTAL))) { - addWorker(); - break; - } - } - } - - try { - if (!done) - do { - } while (!blocker.isReleasable() && !blocker.block()); - } finally { - if (dec) { - int c; - do { - } while (!UNSAFE.compareAndSwapInt(this, - workerCountsOffset, - c = workerCounts, - c + ONE_RUNNING)); - } - } - } - - /** - * Possibly initiates and/or completes termination. - * - * @param now if true, unconditionally terminate, else only - * if shutdown and empty queue and no active workers - * @return true if now terminating or terminated - */ - private boolean tryTerminate(boolean now) { - if (now) - advanceRunLevel(SHUTDOWN); // ensure at least SHUTDOWN - else if (runState < SHUTDOWN || - !submissionQueue.isEmpty() || - (runState & ACTIVE_COUNT_MASK) != 0) - return false; - - if (advanceRunLevel(TERMINATING)) - startTerminating(); - - // Finish now if all threads terminated; else in some subsequent call - if ((workerCounts >>> TOTAL_COUNT_SHIFT) == 0) { - advanceRunLevel(TERMINATED); - terminationLatch.countDown(); - } - return true; - } - - /** - * Actions on transition to TERMINATING - */ - private void startTerminating() { - // Clear out and cancel submissions, ignoring exceptions - ForkJoinTask task; - while ((task = submissionQueue.poll()) != null) { - try { - task.cancel(false); - } catch (Throwable ignore) { - } - } - // Propagate run level - for (ForkJoinWorkerThread w : workers) { - if (w != null) - w.shutdown(); // also resumes suspended workers - } - // Ensure no straggling local tasks - for (ForkJoinWorkerThread w : workers) { - if (w != null) - w.cancelTasks(); - } - // Wake up idle workers - advanceEventCount(); - releaseWaiters(); - // Unstick pending joins - for (ForkJoinWorkerThread w : workers) { - if (w != null && !w.isTerminated()) { - try { - w.interrupt(); - } catch (SecurityException ignore) { - } - } - } - } - - // misc support for ForkJoinWorkerThread - - /** - * Returns pool number - */ - final int getPoolNumber() { - return poolNumber; - } - - /** - * Accumulates steal count from a worker, clearing - * the worker's value - */ - final void accumulateStealCount(ForkJoinWorkerThread w) { - int sc = w.stealCount; - if (sc != 0) { - long c; - w.stealCount = 0; - do { - } while (!UNSAFE.compareAndSwapLong(this, stealCountOffset, - c = stealCount, c + sc)); - } - } - - /** - * Returns the approximate (non-atomic) number of idle threads per - * active thread. - */ - final int idlePerActive() { - int ac = runState; // no mask -- artifically boosts during shutdown - int pc = parallelism; // use targeted parallelism, not rc - // Use exact results for small values, saturate past 4 - return pc <= ac ? 0 : pc >>> 1 <= ac ? 1 : pc >>> 2 <= ac ? 3 : pc >>> 3; - } - - /** - * Returns the approximate (non-atomic) difference between running - * and active counts. - */ - final int inactiveCount() { - return (workerCounts & RUNNING_COUNT_MASK) - - (runState & ACTIVE_COUNT_MASK); - } - - // Public and protected methods - - // Constructors - - /** - * Creates a {@code ForkJoinPool} with parallelism equal to {@link - * java.lang.Runtime#availableProcessors}, and using the {@linkplain - * #defaultForkJoinWorkerThreadFactory default thread factory}. - * - * @throws SecurityException if a security manager exists and - * the caller is not permitted to modify threads - * because it does not hold {@link - * java.lang.RuntimePermission}{@code ("modifyThread")} - */ - public ForkJoinPool() { - this(Runtime.getRuntime().availableProcessors(), - defaultForkJoinWorkerThreadFactory); - } - - /** - * Creates a {@code ForkJoinPool} with the indicated parallelism - * level and using the {@linkplain - * #defaultForkJoinWorkerThreadFactory default thread factory}. - * - * @param parallelism the parallelism level - * @throws IllegalArgumentException if parallelism less than or - * equal to zero, or greater than implementation limit - * @throws SecurityException if a security manager exists and - * the caller is not permitted to modify threads - * because it does not hold {@link - * java.lang.RuntimePermission}{@code ("modifyThread")} - */ - public ForkJoinPool(int parallelism) { - this(parallelism, defaultForkJoinWorkerThreadFactory); - } - - /** - * Creates a {@code ForkJoinPool} with parallelism equal to {@link - * java.lang.Runtime#availableProcessors}, and using the given - * thread factory. - * - * @param factory the factory for creating new threads - * @throws NullPointerException if the factory is null - * @throws SecurityException if a security manager exists and - * the caller is not permitted to modify threads - * because it does not hold {@link - * java.lang.RuntimePermission}{@code ("modifyThread")} - */ - public ForkJoinPool(ForkJoinWorkerThreadFactory factory) { - this(Runtime.getRuntime().availableProcessors(), factory); - } - - /** - * Creates a {@code ForkJoinPool} with the given parallelism and - * thread factory. - * - * @param parallelism the parallelism level - * @param factory the factory for creating new threads - * @throws IllegalArgumentException if parallelism less than or - * equal to zero, or greater than implementation limit - * @throws NullPointerException if the factory is null - * @throws SecurityException if a security manager exists and - * the caller is not permitted to modify threads - * because it does not hold {@link - * java.lang.RuntimePermission}{@code ("modifyThread")} - */ - public ForkJoinPool(int parallelism, ForkJoinWorkerThreadFactory factory) { - checkPermission(); - if (factory == null) - throw new NullPointerException(); - if (parallelism <= 0 || parallelism > MAX_THREADS) - throw new IllegalArgumentException(); - this.poolNumber = poolNumberGenerator.incrementAndGet(); - int arraySize = initialArraySizeFor(parallelism); - this.parallelism = parallelism; - this.factory = factory; - this.maxPoolSize = MAX_THREADS; - this.maintainsParallelism = true; - this.workers = new ForkJoinWorkerThread[arraySize]; - this.submissionQueue = new LinkedTransferQueue>(); - this.workerLock = new ReentrantLock(); - this.terminationLatch = new CountDownLatch(1); - // Start first worker; remaining workers added upon first submission - workerCounts = ONE_RUNNING | ONE_TOTAL; - addWorker(); - } - - /** - * Returns initial power of two size for workers array. - * - * @param pc the initial parallelism level - */ - private static int initialArraySizeFor(int pc) { - // See Hackers Delight, sec 3.2. We know MAX_THREADS < (1 >>> 16) - int size = pc < MAX_THREADS ? pc + 1 : MAX_THREADS; - size |= size >>> 1; - size |= size >>> 2; - size |= size >>> 4; - size |= size >>> 8; - return size + 1; - } - - // Execution methods - - /** - * Common code for execute, invoke and submit - */ - private void doSubmit(ForkJoinTask task) { - if (task == null) - throw new NullPointerException(); - if (runState >= SHUTDOWN) - throw new RejectedExecutionException(); - submissionQueue.offer(task); - advanceEventCount(); - releaseWaiters(); - if ((workerCounts >>> TOTAL_COUNT_SHIFT) < parallelism) - ensureEnoughTotalWorkers(); - } - - /** - * Performs the given task, returning its result upon completion. - * - * @param task the task - * @return the task's result - * @throws NullPointerException if the task is null - * @throws RejectedExecutionException if the task cannot be - * scheduled for execution - */ - public T invoke(ForkJoinTask task) { - doSubmit(task); - return task.join(); - } - - /** - * Arranges for (asynchronous) execution of the given task. - * - * @param task the task - * @throws NullPointerException if the task is null - * @throws RejectedExecutionException if the task cannot be - * scheduled for execution - */ - public void execute(ForkJoinTask task) { - doSubmit(task); - } - - // AbstractExecutorService methods - - /** - * @throws NullPointerException if the task is null - * @throws RejectedExecutionException if the task cannot be - * scheduled for execution - */ - public void execute(Runnable task) { - ForkJoinTask job; - if (task instanceof ForkJoinTask) // avoid re-wrap - job = (ForkJoinTask) task; - else - job = ForkJoinTask.adapt(task, null); - doSubmit(job); - } - - /** - * @throws NullPointerException if the task is null - * @throws RejectedExecutionException if the task cannot be - * scheduled for execution - */ - public ForkJoinTask submit(Callable task) { - ForkJoinTask job = ForkJoinTask.adapt(task); - doSubmit(job); - return job; - } - - /** - * @throws NullPointerException if the task is null - * @throws RejectedExecutionException if the task cannot be - * scheduled for execution - */ - public ForkJoinTask submit(Runnable task, T result) { - ForkJoinTask job = ForkJoinTask.adapt(task, result); - doSubmit(job); - return job; - } - - /** - * @throws NullPointerException if the task is null - * @throws RejectedExecutionException if the task cannot be - * scheduled for execution - */ - public ForkJoinTask submit(Runnable task) { - ForkJoinTask job; - if (task instanceof ForkJoinTask) // avoid re-wrap - job = (ForkJoinTask) task; - else - job = ForkJoinTask.adapt(task, null); - doSubmit(job); - return job; - } - - /** - * Submits a ForkJoinTask for execution. - * - * @param task the task to submit - * @return the task - * @throws NullPointerException if the task is null - * @throws RejectedExecutionException if the task cannot be - * scheduled for execution - */ - public ForkJoinTask submit(ForkJoinTask task) { - doSubmit(task); - return task; - } - - /** - * @throws NullPointerException {@inheritDoc} - * @throws RejectedExecutionException {@inheritDoc} - */ - public List> invokeAll(Collection> tasks) { - ArrayList> forkJoinTasks = - new ArrayList>(tasks.size()); - for (Callable task : tasks) - forkJoinTasks.add(ForkJoinTask.adapt(task)); - invoke(new InvokeAll(forkJoinTasks)); - - @SuppressWarnings({"unchecked", "rawtypes"}) - List> futures = (List>) (List) forkJoinTasks; - return futures; - } - - static final class InvokeAll extends RecursiveAction { - final ArrayList> tasks; - - InvokeAll(ArrayList> tasks) { - this.tasks = tasks; - } - - public void compute() { - try { - invokeAll(tasks); - } - catch (Exception ignore) { - } - } - - private static final long serialVersionUID = -7914297376763021607L; - } - - /** - * Returns the factory used for constructing new workers. - * - * @return the factory used for constructing new workers - */ - public ForkJoinWorkerThreadFactory getFactory() { - return factory; - } - - /** - * Returns the handler for internal worker threads that terminate - * due to unrecoverable errors encountered while executing tasks. - * - * @return the handler, or {@code null} if none - */ - public Thread.UncaughtExceptionHandler getUncaughtExceptionHandler() { - workerCountReadFence(); - return ueh; - } - - /** - * Sets the handler for internal worker threads that terminate due - * to unrecoverable errors encountered while executing tasks. - * Unless set, the current default or ThreadGroup handler is used - * as handler. - * - * @param h the new handler - * @return the old handler, or {@code null} if none - * @throws SecurityException if a security manager exists and - * the caller is not permitted to modify threads - * because it does not hold {@link - * java.lang.RuntimePermission}{@code ("modifyThread")} - */ - public Thread.UncaughtExceptionHandler - setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler h) { - checkPermission(); - workerCountReadFence(); - Thread.UncaughtExceptionHandler old = ueh; - if (h != old) { - ueh = h; - workerCountWriteFence(); - for (ForkJoinWorkerThread w : workers) { - if (w != null) - w.setUncaughtExceptionHandler(h); - } - } - return old; - } - - /** - * Sets the target parallelism level of this pool. - * - * @param parallelism the target parallelism - * @throws IllegalArgumentException if parallelism less than or - * equal to zero or greater than maximum size bounds - * @throws SecurityException if a security manager exists and - * the caller is not permitted to modify threads - * because it does not hold {@link - * java.lang.RuntimePermission}{@code ("modifyThread")} - */ - public void setParallelism(int parallelism) { - checkPermission(); - if (parallelism <= 0 || parallelism > maxPoolSize) - throw new IllegalArgumentException(); - workerCountReadFence(); - int pc = this.parallelism; - if (pc != parallelism) { - this.parallelism = parallelism; - workerCountWriteFence(); - // Release spares. If too many, some will die after re-suspend - for (ForkJoinWorkerThread w : workers) { - if (w != null && w.tryUnsuspend()) { - updateRunningCount(1); - LockSupport.unpark(w); - } - } - ensureEnoughTotalWorkers(); - advanceEventCount(); - releaseWaiters(); // force config recheck by existing workers - } - } - - /** - * Returns the targeted parallelism level of this pool. - * - * @return the targeted parallelism level of this pool - */ - public int getParallelism() { - // workerCountReadFence(); // inlined below - int ignore = workerCounts; - return parallelism; - } - - /** - * Returns the number of worker threads that have started but not - * yet terminated. This result returned by this method may differ - * from {@link #getParallelism} when threads are created to - * maintain parallelism when others are cooperatively blocked. - * - * @return the number of worker threads - */ - public int getPoolSize() { - return workerCounts >>> TOTAL_COUNT_SHIFT; - } - - /** - * Returns the maximum number of threads allowed to exist in the - * pool. Unless set using {@link #setMaximumPoolSize}, the - * maximum is an implementation-defined value designed only to - * prevent runaway growth. - * - * @return the maximum - */ - public int getMaximumPoolSize() { - workerCountReadFence(); - return maxPoolSize; - } - - /** - * Sets the maximum number of threads allowed to exist in the - * pool. The given value should normally be greater than or equal - * to the {@link #getParallelism parallelism} level. Setting this - * value has no effect on current pool size. It controls - * construction of new threads. - * - * @throws IllegalArgumentException if negative or greater than - * internal implementation limit - */ - public void setMaximumPoolSize(int newMax) { - if (newMax < 0 || newMax > MAX_THREADS) - throw new IllegalArgumentException(); - maxPoolSize = newMax; - workerCountWriteFence(); - } - - /** - * Returns {@code true} if this pool dynamically maintains its - * target parallelism level. If false, new threads are added only - * to avoid possible starvation. This setting is by default true. - * - * @return {@code true} if maintains parallelism - */ - public boolean getMaintainsParallelism() { - workerCountReadFence(); - return maintainsParallelism; - } - - /** - * Sets whether this pool dynamically maintains its target - * parallelism level. If false, new threads are added only to - * avoid possible starvation. - * - * @param enable {@code true} to maintain parallelism - */ - public void setMaintainsParallelism(boolean enable) { - maintainsParallelism = enable; - workerCountWriteFence(); - } - - /** - * Establishes local first-in-first-out scheduling mode for forked - * tasks that are never joined. This mode may be more appropriate - * than default locally stack-based mode in applications in which - * worker threads only process asynchronous tasks. This method is - * designed to be invoked only when the pool is quiescent, and - * typically only before any tasks are submitted. The effects of - * invocations at other times may be unpredictable. - * - * @param async if {@code true}, use locally FIFO scheduling - * @return the previous mode - * @see #getAsyncMode - */ - public boolean setAsyncMode(boolean async) { - workerCountReadFence(); - boolean oldMode = locallyFifo; - if (oldMode != async) { - locallyFifo = async; - workerCountWriteFence(); - for (ForkJoinWorkerThread w : workers) { - if (w != null) - w.setAsyncMode(async); - } - } - return oldMode; - } - - /** - * Returns {@code true} if this pool uses local first-in-first-out - * scheduling mode for forked tasks that are never joined. - * - * @return {@code true} if this pool uses async mode - * @see #setAsyncMode - */ - public boolean getAsyncMode() { - workerCountReadFence(); - return locallyFifo; - } - - /** - * Returns an estimate of the number of worker threads that are - * not blocked waiting to join tasks or for other managed - * synchronization. This method may overestimate the - * number of running threads. - * - * @return the number of worker threads - */ - public int getRunningThreadCount() { - return workerCounts & RUNNING_COUNT_MASK; - } - - /** - * Returns an estimate of the number of threads that are currently - * stealing or executing tasks. This method may overestimate the - * number of active threads. - * - * @return the number of active threads - */ - public int getActiveThreadCount() { - return runState & ACTIVE_COUNT_MASK; - } - - /** - * Returns {@code true} if all worker threads are currently idle. - * An idle worker is one that cannot obtain a task to execute - * because none are available to steal from other threads, and - * there are no pending submissions to the pool. This method is - * conservative; it might not return {@code true} immediately upon - * idleness of all threads, but will eventually become true if - * threads remain inactive. - * - * @return {@code true} if all threads are currently idle - */ - public boolean isQuiescent() { - return (runState & ACTIVE_COUNT_MASK) == 0; - } - - /** - * Returns an estimate of the total number of tasks stolen from - * one thread's work queue by another. The reported value - * underestimates the actual total number of steals when the pool - * is not quiescent. This value may be useful for monitoring and - * tuning fork/join programs: in general, steal counts should be - * high enough to keep threads busy, but low enough to avoid - * overhead and contention across threads. - * - * @return the number of steals - */ - public long getStealCount() { - return stealCount; - } - - /** - * Returns an estimate of the total number of tasks currently held - * in queues by worker threads (but not including tasks submitted - * to the pool that have not begun executing). This value is only - * an approximation, obtained by iterating across all threads in - * the pool. This method may be useful for tuning task - * granularities. - * - * @return the number of queued tasks - */ - public long getQueuedTaskCount() { - long count = 0; - for (ForkJoinWorkerThread w : workers) { - if (w != null) - count += w.getQueueSize(); - } - return count; - } - - /** - * Returns an estimate of the number of tasks submitted to this - * pool that have not yet begun executing. This method takes time - * proportional to the number of submissions. - * - * @return the number of queued submissions - */ - public int getQueuedSubmissionCount() { - return submissionQueue.size(); - } - - /** - * Returns {@code true} if there are any tasks submitted to this - * pool that have not yet begun executing. - * - * @return {@code true} if there are any queued submissions - */ - public boolean hasQueuedSubmissions() { - return !submissionQueue.isEmpty(); - } - - /** - * Removes and returns the next unexecuted submission if one is - * available. This method may be useful in extensions to this - * class that re-assign work in systems with multiple pools. - * - * @return the next submission, or {@code null} if none - */ - protected ForkJoinTask pollSubmission() { - return submissionQueue.poll(); - } - - /** - * Removes all available unexecuted submitted and forked tasks - * from scheduling queues and adds them to the given collection, - * without altering their execution status. These may include - * artificially generated or wrapped tasks. This method is - * designed to be invoked only when the pool is known to be - * quiescent. Invocations at other times may not remove all - * tasks. A failure encountered while attempting to add elements - * to collection {@code c} may result in elements being in - * neither, either or both collections when the associated - * exception is thrown. The behavior of this operation is - * undefined if the specified collection is modified while the - * operation is in progress. - * - * @param c the collection to transfer elements into - * @return the number of elements transferred - */ - protected int drainTasksTo(Collection> c) { - int n = submissionQueue.drainTo(c); - for (ForkJoinWorkerThread w : workers) { - if (w != null) - n += w.drainTasksTo(c); - } - return n; - } - - /** - * Returns a string identifying this pool, as well as its state, - * including indications of run state, parallelism level, and - * worker and task counts. - * - * @return a string identifying this pool, as well as its state - */ - public String toString() { - long st = getStealCount(); - long qt = getQueuedTaskCount(); - long qs = getQueuedSubmissionCount(); - int wc = workerCounts; - int tc = wc >>> TOTAL_COUNT_SHIFT; - int rc = wc & RUNNING_COUNT_MASK; - int pc = parallelism; - int rs = runState; - int ac = rs & ACTIVE_COUNT_MASK; - return super.toString() + - "[" + runLevelToString(rs) + - ", parallelism = " + pc + - ", size = " + tc + - ", active = " + ac + - ", running = " + rc + - ", steals = " + st + - ", tasks = " + qt + - ", submissions = " + qs + - "]"; - } - - private static String runLevelToString(int s) { - return ((s & TERMINATED) != 0 ? "Terminated" : - ((s & TERMINATING) != 0 ? "Terminating" : - ((s & SHUTDOWN) != 0 ? "Shutting down" : - "Running"))); - } - - /** - * Initiates an orderly shutdown in which previously submitted - * tasks are executed, but no new tasks will be accepted. - * Invocation has no additional effect if already shut down. - * Tasks that are in the process of being submitted concurrently - * during the course of this method may or may not be rejected. - * - * @throws SecurityException if a security manager exists and - * the caller is not permitted to modify threads - * because it does not hold {@link - * java.lang.RuntimePermission}{@code ("modifyThread")} - */ - public void shutdown() { - checkPermission(); - advanceRunLevel(SHUTDOWN); - tryTerminate(false); - } - - /** - * Attempts to cancel and/or stop all tasks, and reject all - * subsequently submitted tasks. Tasks that are in the process of - * being submitted or executed concurrently during the course of - * this method may or may not be rejected. This method cancels - * both existing and unexecuted tasks, in order to permit - * termination in the presence of task dependencies. So the method - * always returns an empty list (unlike the case for some other - * Executors). - * - * @return an empty list - * @throws SecurityException if a security manager exists and - * the caller is not permitted to modify threads - * because it does not hold {@link - * java.lang.RuntimePermission}{@code ("modifyThread")} - */ - public List shutdownNow() { - checkPermission(); - tryTerminate(true); - return Collections.emptyList(); - } - - /** - * Returns {@code true} if all tasks have completed following shut down. - * - * @return {@code true} if all tasks have completed following shut down - */ - public boolean isTerminated() { - return runState >= TERMINATED; - } - - /** - * Returns {@code true} if the process of termination has - * commenced but not yet completed. This method may be useful for - * debugging. A return of {@code true} reported a sufficient - * period after shutdown may indicate that submitted tasks have - * ignored or suppressed interruption, causing this executor not - * to properly terminate. - * - * @return {@code true} if terminating but not yet terminated - */ - public boolean isTerminating() { - return (runState & (TERMINATING | TERMINATED)) == TERMINATING; - } - - /** - * Returns {@code true} if this pool has been shut down. - * - * @return {@code true} if this pool has been shut down - */ - public boolean isShutdown() { - return runState >= SHUTDOWN; - } - - /** - * Blocks until all tasks have completed execution after a shutdown - * request, or the timeout occurs, or the current thread is - * interrupted, whichever happens first. - * - * @param timeout the maximum time to wait - * @param unit the time unit of the timeout argument - * @return {@code true} if this executor terminated and - * {@code false} if the timeout elapsed before termination - * @throws InterruptedException if interrupted while waiting - */ - public boolean awaitTermination(long timeout, TimeUnit unit) - throws InterruptedException { - return terminationLatch.await(timeout, unit); - } - - /** - * Interface for extending managed parallelism for tasks running - * in {@link ForkJoinPool}s. - * - *

A {@code ManagedBlocker} provides two methods. - * Method {@code isReleasable} must return {@code true} if - * blocking is not necessary. Method {@code block} blocks the - * current thread if necessary (perhaps internally invoking - * {@code isReleasable} before actually blocking). - * - *

For example, here is a ManagedBlocker based on a - * ReentrantLock: - *

 {@code
-     * class ManagedLocker implements ManagedBlocker {
-     *   final ReentrantLock lock;
-     *   boolean hasLock = false;
-     *   ManagedLocker(ReentrantLock lock) { this.lock = lock; }
-     *   public boolean block() {
-     *     if (!hasLock)
-     *       lock.lock();
-     *     return true;
-     *   }
-     *   public boolean isReleasable() {
-     *     return hasLock || (hasLock = lock.tryLock());
-     *   }
-     * }}
- */ - public static interface ManagedBlocker { - /** - * Possibly blocks the current thread, for example waiting for - * a lock or condition. - * - * @return {@code true} if no additional blocking is necessary - * (i.e., if isReleasable would return true) - * @throws InterruptedException if interrupted while waiting - * (the method is not required to do so, but is allowed to) - */ - boolean block() throws InterruptedException; - - /** - * Returns {@code true} if blocking is unnecessary. - */ - boolean isReleasable(); - } - - /** - * Blocks in accord with the given blocker. If the current thread - * is a {@link ForkJoinWorkerThread}, this method possibly - * arranges for a spare thread to be activated if necessary to - * ensure parallelism while the current thread is blocked. - * - *

If {@code maintainParallelism} is {@code true} and the pool - * supports it ({@link #getMaintainsParallelism}), this method - * attempts to maintain the pool's nominal parallelism. Otherwise - * it activates a thread only if necessary to avoid complete - * starvation. This option may be preferable when blockages use - * timeouts, or are almost always brief. - * - *

If the caller is not a {@link ForkJoinTask}, this method is - * behaviorally equivalent to - *

 {@code
-     * while (!blocker.isReleasable())
-     *   if (blocker.block())
-     *     return;
-     * }
- * - * If the caller is a {@code ForkJoinTask}, then the pool may - * first be expanded to ensure parallelism, and later adjusted. - * - * @param blocker the blocker - * @param maintainParallelism if {@code true} and supported by - * this pool, attempt to maintain the pool's nominal parallelism; - * otherwise activate a thread only if necessary to avoid - * complete starvation. - * @throws InterruptedException if blocker.block did so - */ - public static void managedBlock(ManagedBlocker blocker, - boolean maintainParallelism) - throws InterruptedException { - Thread t = Thread.currentThread(); - if (t instanceof ForkJoinWorkerThread) - ((ForkJoinWorkerThread) t).pool. - doBlock(blocker, maintainParallelism); - else - awaitBlocker(blocker); - } - - /** - * Performs Non-FJ blocking - */ - private static void awaitBlocker(ManagedBlocker blocker) - throws InterruptedException { - do { - } while (!blocker.isReleasable() && !blocker.block()); - } - - // AbstractExecutorService overrides. These rely on undocumented - // fact that ForkJoinTask.adapt returns ForkJoinTasks that also - // implement RunnableFuture. - - protected RunnableFuture newTaskFor(Runnable runnable, T value) { - return (RunnableFuture) ForkJoinTask.adapt(runnable, value); - } - - protected RunnableFuture newTaskFor(Callable callable) { - return (RunnableFuture) ForkJoinTask.adapt(callable); - } - - // Unsafe mechanics - - private static final sun.misc.Unsafe UNSAFE = getUnsafe(); - private static final long workerCountsOffset = - objectFieldOffset("workerCounts", ForkJoinPool.class); - private static final long runStateOffset = - objectFieldOffset("runState", ForkJoinPool.class); - private static final long eventCountOffset = - objectFieldOffset("eventCount", ForkJoinPool.class); - private static final long eventWaitersOffset = - objectFieldOffset("eventWaiters", ForkJoinPool.class); - private static final long stealCountOffset = - objectFieldOffset("stealCount", ForkJoinPool.class); - - - private static long objectFieldOffset(String field, Class klazz) { - try { - return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field)); - } catch (NoSuchFieldException e) { - // Convert Exception to corresponding Error - NoSuchFieldError error = new NoSuchFieldError(field); - error.initCause(e); - throw error; - } - } - - /** - * Returns a sun.misc.Unsafe. Suitable for use in a 3rd party package. - * Replace with a simple call to Unsafe.getUnsafe when integrating - * into a jdk. - * - * @return a sun.misc.Unsafe - */ - private static sun.misc.Unsafe getUnsafe() { - try { - return sun.misc.Unsafe.getUnsafe(); - } catch (SecurityException se) { - try { - return java.security.AccessController.doPrivileged - (new java.security - .PrivilegedExceptionAction() { - public sun.misc.Unsafe run() throws Exception { - java.lang.reflect.Field f = sun.misc - .Unsafe.class.getDeclaredField("theUnsafe"); - f.setAccessible(true); - return (sun.misc.Unsafe) f.get(null); - } - }); - } catch (java.security.PrivilegedActionException e) { - throw new RuntimeException("Could not initialize intrinsics", - e.getCause()); - } - } - } -} diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/ForkJoinTask.java b/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/ForkJoinTask.java deleted file mode 100644 index 9faea990447..00000000000 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/ForkJoinTask.java +++ /dev/null @@ -1,1306 +0,0 @@ -/* - * Licensed to Elastic Search and Shay Banon under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. Elastic Search 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. - */ - -/* - * Written by Doug Lea with assistance from members of JCP JSR-166 - * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain - */ - -package org.elasticsearch.util.concurrent.jsr166y; - -import java.io.Serializable; -import java.util.*; -import java.util.concurrent.*; - -/** - * Abstract base class for tasks that run within a {@link ForkJoinPool}. - * A {@code ForkJoinTask} is a thread-like entity that is much - * lighter weight than a normal thread. Huge numbers of tasks and - * subtasks may be hosted by a small number of actual threads in a - * ForkJoinPool, at the price of some usage limitations. - * - *

A "main" {@code ForkJoinTask} begins execution when submitted - * to a {@link ForkJoinPool}. Once started, it will usually in turn - * start other subtasks. As indicated by the name of this class, - * many programs using {@code ForkJoinTask} employ only methods - * {@link #fork} and {@link #join}, or derivatives such as {@link - * #invokeAll}. However, this class also provides a number of other - * methods that can come into play in advanced usages, as well as - * extension mechanics that allow support of new forms of fork/join - * processing. - * - *

A {@code ForkJoinTask} is a lightweight form of {@link Future}. - * The efficiency of {@code ForkJoinTask}s stems from a set of - * restrictions (that are only partially statically enforceable) - * reflecting their intended use as computational tasks calculating - * pure functions or operating on purely isolated objects. The - * primary coordination mechanisms are {@link #fork}, that arranges - * asynchronous execution, and {@link #join}, that doesn't proceed - * until the task's result has been computed. Computations should - * avoid {@code synchronized} methods or blocks, and should minimize - * other blocking synchronization apart from joining other tasks or - * using synchronizers such as Phasers that are advertised to - * cooperate with fork/join scheduling. Tasks should also not perform - * blocking IO, and should ideally access variables that are - * completely independent of those accessed by other running - * tasks. Minor breaches of these restrictions, for example using - * shared output streams, may be tolerable in practice, but frequent - * use may result in poor performance, and the potential to - * indefinitely stall if the number of threads not waiting for IO or - * other external synchronization becomes exhausted. This usage - * restriction is in part enforced by not permitting checked - * exceptions such as {@code IOExceptions} to be thrown. However, - * computations may still encounter unchecked exceptions, that are - * rethrown to callers attempting to join them. These exceptions may - * additionally include {@link RejectedExecutionException} stemming - * from internal resource exhaustion, such as failure to allocate - * internal task queues. - * - *

The primary method for awaiting completion and extracting - * results of a task is {@link #join}, but there are several variants: - * The {@link Future#get} methods support interruptible and/or timed - * waits for completion and report results using {@code Future} - * conventions. Method {@link #helpJoin} enables callers to actively - * execute other tasks while awaiting joins, which is sometimes more - * efficient but only applies when all subtasks are known to be - * strictly tree-structured. Method {@link #invoke} is semantically - * equivalent to {@code fork(); join()} but always attempts to begin - * execution in the current thread. The "quiet" forms of - * these methods do not extract results or report exceptions. These - * may be useful when a set of tasks are being executed, and you need - * to delay processing of results or exceptions until all complete. - * Method {@code invokeAll} (available in multiple versions) - * performs the most common form of parallel invocation: forking a set - * of tasks and joining them all. - * - *

The execution status of tasks may be queried at several levels - * of detail: {@link #isDone} is true if a task completed in any way - * (including the case where a task was cancelled without executing); - * {@link #isCompletedNormally} is true if a task completed without - * cancellation or encountering an exception; {@link #isCancelled} is - * true if the task was cancelled (in which case {@link #getException} - * returns a {@link java.util.concurrent.CancellationException}); and - * {@link #isCompletedAbnormally} is true if a task was either - * cancelled or encountered an exception, in which case {@link - * #getException} will return either the encountered exception or - * {@link java.util.concurrent.CancellationException}. - * - *

The ForkJoinTask class is not usually directly subclassed. - * Instead, you subclass one of the abstract classes that support a - * particular style of fork/join processing, typically {@link - * RecursiveAction} for computations that do not return results, or - * {@link RecursiveTask} for those that do. Normally, a concrete - * ForkJoinTask subclass declares fields comprising its parameters, - * established in a constructor, and then defines a {@code compute} - * method that somehow uses the control methods supplied by this base - * class. While these methods have {@code public} access (to allow - * instances of different task subclasses to call each other's - * methods), some of them may only be called from within other - * ForkJoinTasks (as may be determined using method {@link - * #inForkJoinPool}). Attempts to invoke them in other contexts - * result in exceptions or errors, possibly including - * ClassCastException. - * - *

Most base support methods are {@code final}, to prevent - * overriding of implementations that are intrinsically tied to the - * underlying lightweight task scheduling framework. Developers - * creating new basic styles of fork/join processing should minimally - * implement {@code protected} methods {@link #exec}, {@link - * #setRawResult}, and {@link #getRawResult}, while also introducing - * an abstract computational method that can be implemented in its - * subclasses, possibly relying on other {@code protected} methods - * provided by this class. - * - *

ForkJoinTasks should perform relatively small amounts of - * computation. Large tasks should be split into smaller subtasks, - * usually via recursive decomposition. As a very rough rule of thumb, - * a task should perform more than 100 and less than 10000 basic - * computational steps. If tasks are too big, then parallelism cannot - * improve throughput. If too small, then memory and internal task - * maintenance overhead may overwhelm processing. - * - *

This class provides {@code adapt} methods for {@link Runnable} - * and {@link Callable}, that may be of use when mixing execution of - * {@code ForkJoinTasks} with other kinds of tasks. When all tasks - * are of this form, consider using a pool in - * {@linkplain ForkJoinPool#setAsyncMode async mode}. - * - *

ForkJoinTasks are {@code Serializable}, which enables them to be - * used in extensions such as remote execution frameworks. It is - * sensible to serialize tasks only before or after, but not during, - * execution. Serialization is not relied on during execution itself. - * - * @author Doug Lea - * @since 1.7 - */ -public abstract class ForkJoinTask implements Future, Serializable { - - /* - * See the internal documentation of class ForkJoinPool for a - * general implementation overview. ForkJoinTasks are mainly - * responsible for maintaining their "status" field amidst relays - * to methods in ForkJoinWorkerThread and ForkJoinPool. The - * methods of this class are more-or-less layered into (1) basic - * status maintenance (2) execution and awaiting completion (3) - * user-level methods that additionally report results. This is - * sometimes hard to see because this file orders exported methods - * in a way that flows well in javadocs. - */ - - /** - * Run control status bits packed into a single int to minimize - * footprint and to ensure atomicity (via CAS). Status is - * initially zero, and takes on nonnegative values until - * completed, upon which status holds COMPLETED. CANCELLED, or - * EXCEPTIONAL, which use the top 3 bits. Tasks undergoing - * blocking waits by other threads have SIGNAL_MASK bits set -- - * bit 15 for external (nonFJ) waits, and the rest a count of - * waiting FJ threads. (This representation relies on - * ForkJoinPool max thread limits). Signal counts are not directly - * incremented by ForkJoinTask methods, but instead via a call to - * requestSignal within ForkJoinPool.preJoin, once their need is - * established. - * - * Completion of a stolen task with SIGNAL_MASK bits set awakens - * any waiters via notifyAll. Even though suboptimal for some - * purposes, we use basic builtin wait/notify to take advantage of - * "monitor inflation" in JVMs that we would otherwise need to - * emulate to avoid adding further per-task bookkeeping overhead. - * We want these monitors to be "fat", i.e., not use biasing or - * thin-lock techniques, so use some odd coding idioms that tend - * to avoid them. - * - * Note that bits 16-28 are currently unused. Also value - * 0x80000000 is available as spare completion value. - */ - volatile int status; // accessed directly by pool and workers - - private static final int COMPLETION_MASK = 0xe0000000; - private static final int NORMAL = 0xe0000000; // == mask - private static final int CANCELLED = 0xc0000000; - private static final int EXCEPTIONAL = 0xa0000000; - private static final int SIGNAL_MASK = 0x0000ffff; - private static final int INTERNAL_SIGNAL_MASK = 0x00007fff; - private static final int EXTERNAL_SIGNAL = 0x00008000; - - /** - * Table of exceptions thrown by tasks, to enable reporting by - * callers. Because exceptions are rare, we don't directly keep - * them with task objects, but instead use a weak ref table. Note - * that cancellation exceptions don't appear in the table, but are - * instead recorded as status values. - * TODO: Use ConcurrentReferenceHashMap - */ - static final Map, Throwable> exceptionMap = - Collections.synchronizedMap - (new WeakHashMap, Throwable>()); - - // Maintaining completion status - - /** - * Marks completion and wakes up threads waiting to join this task, - * also clearing signal request bits. - * - * @param completion one of NORMAL, CANCELLED, EXCEPTIONAL - */ - private void setCompletion(int completion) { - int s; - while ((s = status) >= 0) { - if (UNSAFE.compareAndSwapInt(this, statusOffset, s, completion)) { - if ((s & SIGNAL_MASK) != 0) { - Thread t = Thread.currentThread(); - if (t instanceof ForkJoinWorkerThread) - ((ForkJoinWorkerThread) t).pool.updateRunningCount - (s & INTERNAL_SIGNAL_MASK); - synchronized (this) { - notifyAll(); - } - } - return; - } - } - } - - /** - * Record exception and set exceptional completion - */ - private void setDoneExceptionally(Throwable rex) { - exceptionMap.put(this, rex); - setCompletion(EXCEPTIONAL); - } - - /** - * Main internal execution method: Unless done, calls exec and - * records completion. - * - * @return true if ran and completed normally - */ - final boolean tryExec() { - try { - if (status < 0 || !exec()) - return false; - } catch (Throwable rex) { - setDoneExceptionally(rex); - return false; - } - setCompletion(NORMAL); // must be outside try block - return true; - } - - /** - * Increments internal signal count (thus requesting signal upon - * completion) unless already done. Call only once per join. - * Used by ForkJoinPool.preJoin. - * - * @return status - */ - final int requestSignal() { - int s; - do { - } while ((s = status) >= 0 && - !UNSAFE.compareAndSwapInt(this, statusOffset, s, s + 1)); - return s; - } - - /** - * Sets external signal request unless already done. - * - * @return status - */ - private int requestExternalSignal() { - int s; - do { - } while ((s = status) >= 0 && - !UNSAFE.compareAndSwapInt(this, statusOffset, - s, s | EXTERNAL_SIGNAL)); - return s; - } - - /* - * Awaiting completion. The four versions, internal vs external X - * untimed vs timed, have the same overall structure but differ - * from each other enough to defy simple integration. - */ - - /** - * Blocks a worker until this task is done, also maintaining pool - * and signal counts - */ - private void awaitDone(ForkJoinWorkerThread w) { - if (status >= 0) { - w.pool.preJoin(this); - while (status >= 0) { - try { // minimize lock scope - synchronized (this) { - if (status >= 0) - wait(); - else { // help release; also helps avoid lock-biasing - notifyAll(); - break; - } - } - } catch (InterruptedException ie) { - cancelIfTerminating(); - } - } - } - } - - /** - * Blocks a non-ForkJoin thread until this task is done. - */ - private void externalAwaitDone() { - if (requestExternalSignal() >= 0) { - boolean interrupted = false; - while (status >= 0) { - try { - synchronized (this) { - if (status >= 0) - wait(); - else { - notifyAll(); - break; - } - } - } catch (InterruptedException ie) { - interrupted = true; - } - } - if (interrupted) - Thread.currentThread().interrupt(); - } - } - - /** - * Blocks a worker until this task is done or timeout elapses - */ - private void timedAwaitDone(ForkJoinWorkerThread w, long nanos) { - if (status >= 0) { - long startTime = System.nanoTime(); - ForkJoinPool pool = w.pool; - pool.preJoin(this); - while (status >= 0) { - long nt = nanos - (System.nanoTime() - startTime); - if (nt > 0) { - long ms = nt / 1000000; - int ns = (int) (nt % 1000000); - try { - synchronized (this) { - if (status >= 0) wait(ms, ns); - } - } catch (InterruptedException ie) { - cancelIfTerminating(); - } - } else { - int s; // adjust running count on timeout - while ((s = status) >= 0 && - (s & INTERNAL_SIGNAL_MASK) != 0) { - if (UNSAFE.compareAndSwapInt(this, statusOffset, - s, s - 1)) { - pool.updateRunningCount(1); - break; - } - } - break; - } - } - } - } - - /** - * Blocks a non-ForkJoin thread until this task is done or timeout elapses - */ - private void externalTimedAwaitDone(long nanos) { - if (requestExternalSignal() >= 0) { - long startTime = System.nanoTime(); - boolean interrupted = false; - while (status >= 0) { - long nt = nanos - (System.nanoTime() - startTime); - if (nt <= 0) - break; - long ms = nt / 1000000; - int ns = (int) (nt % 1000000); - try { - synchronized (this) { - if (status >= 0) wait(ms, ns); - } - } catch (InterruptedException ie) { - interrupted = true; - } - } - if (interrupted) - Thread.currentThread().interrupt(); - } - } - - // reporting results - - /** - * Returns result or throws the exception associated with status. - * Uses Unsafe as a workaround for javac not allowing rethrow of - * unchecked exceptions. - */ - private V reportResult() { - if ((status & COMPLETION_MASK) < NORMAL) { - Throwable ex = getException(); - if (ex != null) - UNSAFE.throwException(ex); - } - return getRawResult(); - } - - /** - * Returns result or throws exception using j.u.c.Future conventions. - * Only call when {@code isDone} known to be true or thread known - * to be interrupted. - */ - private V reportFutureResult() - throws InterruptedException, ExecutionException { - if (Thread.interrupted()) - throw new InterruptedException(); - int s = status & COMPLETION_MASK; - if (s < NORMAL) { - Throwable ex; - if (s == CANCELLED) - throw new CancellationException(); - if (s == EXCEPTIONAL && (ex = exceptionMap.get(this)) != null) - throw new ExecutionException(ex); - } - return getRawResult(); - } - - /** - * Returns result or throws exception using j.u.c.Future conventions - * with timeouts. - */ - private V reportTimedFutureResult() - throws InterruptedException, ExecutionException, TimeoutException { - if (Thread.interrupted()) - throw new InterruptedException(); - Throwable ex; - int s = status & COMPLETION_MASK; - if (s == NORMAL) - return getRawResult(); - else if (s == CANCELLED) - throw new CancellationException(); - else if (s == EXCEPTIONAL && (ex = exceptionMap.get(this)) != null) - throw new ExecutionException(ex); - else - throw new TimeoutException(); - } - - // public methods - - /** - * Arranges to asynchronously execute this task. While it is not - * necessarily enforced, it is a usage error to fork a task more - * than once unless it has completed and been reinitialized. - * Subsequent modifications to the state of this task or any data - * it operates on are not necessarily consistently observable by - * any thread other than the one executing it unless preceded by a - * call to {@link #join} or related methods, or a call to {@link - * #isDone} returning {@code true}. - * - *

This method may be invoked only from within {@code - * ForkJoinTask} computations (as may be determined using method - * {@link #inForkJoinPool}). Attempts to invoke in other contexts - * result in exceptions or errors, possibly including {@code - * ClassCastException}. - * - * @return {@code this}, to simplify usage - */ - public final ForkJoinTask fork() { - ((ForkJoinWorkerThread) Thread.currentThread()) - .pushTask(this); - return this; - } - - /** - * Returns the result of the computation when it {@link #isDone is done}. - * This method differs from {@link #get()} in that - * abnormal completion results in {@code RuntimeException} or - * {@code Error}, not {@code ExecutionException}. - * - * @return the computed result - */ - public final V join() { - quietlyJoin(); - return reportResult(); - } - - /** - * Commences performing this task, awaits its completion if - * necessary, and return its result, or throws an (unchecked) - * exception if the underlying computation did so. - * - * @return the computed result - */ - public final V invoke() { - if (!tryExec()) - quietlyJoin(); - return reportResult(); - } - - /** - * Forks the given tasks, returning when {@code isDone} holds for - * each task or an (unchecked) exception is encountered, in which - * case the exception is rethrown. If either task encounters an - * exception, the other one may be, but is not guaranteed to be, - * cancelled. If both tasks throw an exception, then this method - * throws one of them. The individual status of each task may be - * checked using {@link #getException()} and related methods. - * - *

This method may be invoked only from within {@code - * ForkJoinTask} computations (as may be determined using method - * {@link #inForkJoinPool}). Attempts to invoke in other contexts - * result in exceptions or errors, possibly including {@code - * ClassCastException}. - * - * @param t1 the first task - * @param t2 the second task - * @throws NullPointerException if any task is null - */ - public static void invokeAll(ForkJoinTask t1, ForkJoinTask t2) { - t2.fork(); - t1.invoke(); - t2.join(); - } - - /** - * Forks the given tasks, returning when {@code isDone} holds for - * each task or an (unchecked) exception is encountered, in which - * case the exception is rethrown. If any task encounters an - * exception, others may be, but are not guaranteed to be, - * cancelled. If more than one task encounters an exception, then - * this method throws any one of these exceptions. The individual - * status of each task may be checked using {@link #getException()} - * and related methods. - * - *

This method may be invoked only from within {@code - * ForkJoinTask} computations (as may be determined using method - * {@link #inForkJoinPool}). Attempts to invoke in other contexts - * result in exceptions or errors, possibly including {@code - * ClassCastException}. - * - * @param tasks the tasks - * @throws NullPointerException if any task is null - */ - public static void invokeAll(ForkJoinTask... tasks) { - Throwable ex = null; - int last = tasks.length - 1; - for (int i = last; i >= 0; --i) { - ForkJoinTask t = tasks[i]; - if (t == null) { - if (ex == null) - ex = new NullPointerException(); - } else if (i != 0) - t.fork(); - else { - t.quietlyInvoke(); - if (ex == null) - ex = t.getException(); - } - } - for (int i = 1; i <= last; ++i) { - ForkJoinTask t = tasks[i]; - if (t != null) { - if (ex != null) - t.cancel(false); - else { - t.quietlyJoin(); - if (ex == null) - ex = t.getException(); - } - } - } - if (ex != null) - UNSAFE.throwException(ex); - } - - /** - * Forks all tasks in the specified collection, returning when - * {@code isDone} holds for each task or an (unchecked) exception - * is encountered. If any task encounters an exception, others - * may be, but are not guaranteed to be, cancelled. If more than - * one task encounters an exception, then this method throws any - * one of these exceptions. The individual status of each task - * may be checked using {@link #getException()} and related - * methods. The behavior of this operation is undefined if the - * specified collection is modified while the operation is in - * progress. - * - *

This method may be invoked only from within {@code - * ForkJoinTask} computations (as may be determined using method - * {@link #inForkJoinPool}). Attempts to invoke in other contexts - * result in exceptions or errors, possibly including {@code - * ClassCastException}. - * - * @param tasks the collection of tasks - * @return the tasks argument, to simplify usage - * @throws NullPointerException if tasks or any element are null - */ - public static > Collection invokeAll(Collection tasks) { - if (!(tasks instanceof RandomAccess) || !(tasks instanceof List)) { - invokeAll(tasks.toArray(new ForkJoinTask[tasks.size()])); - return tasks; - } - @SuppressWarnings("unchecked") - List> ts = - (List>) tasks; - Throwable ex = null; - int last = ts.size() - 1; - for (int i = last; i >= 0; --i) { - ForkJoinTask t = ts.get(i); - if (t == null) { - if (ex == null) - ex = new NullPointerException(); - } else if (i != 0) - t.fork(); - else { - t.quietlyInvoke(); - if (ex == null) - ex = t.getException(); - } - } - for (int i = 1; i <= last; ++i) { - ForkJoinTask t = ts.get(i); - if (t != null) { - if (ex != null) - t.cancel(false); - else { - t.quietlyJoin(); - if (ex == null) - ex = t.getException(); - } - } - } - if (ex != null) - UNSAFE.throwException(ex); - return tasks; - } - - /** - * Attempts to cancel execution of this task. This attempt will - * fail if the task has already completed, has already been - * cancelled, or could not be cancelled for some other reason. If - * successful, and this task has not started when cancel is - * called, execution of this task is suppressed, {@link - * #isCancelled} will report true, and {@link #join} will result - * in a {@code CancellationException} being thrown. - * - *

This method may be overridden in subclasses, but if so, must - * still ensure that these minimal properties hold. In particular, - * the {@code cancel} method itself must not throw exceptions. - * - *

This method is designed to be invoked by other - * tasks. To terminate the current task, you can just return or - * throw an unchecked exception from its computation method, or - * invoke {@link #completeExceptionally}. - * - * @param mayInterruptIfRunning this value is ignored in the - * default implementation because tasks are not - * cancelled via interruption - * @return {@code true} if this task is now cancelled - */ - public boolean cancel(boolean mayInterruptIfRunning) { - setCompletion(CANCELLED); - return (status & COMPLETION_MASK) == CANCELLED; - } - - /** - * Cancels, ignoring any exceptions it throws. Used during worker - * and pool shutdown. - */ - final void cancelIgnoringExceptions() { - try { - cancel(false); - } catch (Throwable ignore) { - } - } - - /** - * Cancels ignoring exceptions if worker is terminating - */ - private void cancelIfTerminating() { - Thread t = Thread.currentThread(); - if ((t instanceof ForkJoinWorkerThread) && - ((ForkJoinWorkerThread) t).isTerminating()) { - try { - cancel(false); - } catch (Throwable ignore) { - } - } - } - - public final boolean isDone() { - return status < 0; - } - - public final boolean isCancelled() { - return (status & COMPLETION_MASK) == CANCELLED; - } - - /** - * Returns {@code true} if this task threw an exception or was cancelled. - * - * @return {@code true} if this task threw an exception or was cancelled - */ - public final boolean isCompletedAbnormally() { - return (status & COMPLETION_MASK) < NORMAL; - } - - /** - * Returns {@code true} if this task completed without throwing an - * exception and was not cancelled. - * - * @return {@code true} if this task completed without throwing an - * exception and was not cancelled - */ - public final boolean isCompletedNormally() { - return (status & COMPLETION_MASK) == NORMAL; - } - - /** - * Returns the exception thrown by the base computation, or a - * {@code CancellationException} if cancelled, or {@code null} if - * none or if the method has not yet completed. - * - * @return the exception, or {@code null} if none - */ - public final Throwable getException() { - int s = status & COMPLETION_MASK; - return ((s >= NORMAL) ? null : - (s == CANCELLED) ? new CancellationException() : - exceptionMap.get(this)); - } - - /** - * Completes this task abnormally, and if not already aborted or - * cancelled, causes it to throw the given exception upon - * {@code join} and related operations. This method may be used - * to induce exceptions in asynchronous tasks, or to force - * completion of tasks that would not otherwise complete. Its use - * in other situations is discouraged. This method is - * overridable, but overridden versions must invoke {@code super} - * implementation to maintain guarantees. - * - * @param ex the exception to throw. If this exception is not a - * {@code RuntimeException} or {@code Error}, the actual exception - * thrown will be a {@code RuntimeException} with cause {@code ex}. - */ - public void completeExceptionally(Throwable ex) { - setDoneExceptionally((ex instanceof RuntimeException) || - (ex instanceof Error) ? ex : - new RuntimeException(ex)); - } - - /** - * Completes this task, and if not already aborted or cancelled, - * returning a {@code null} result upon {@code join} and related - * operations. This method may be used to provide results for - * asynchronous tasks, or to provide alternative handling for - * tasks that would not otherwise complete normally. Its use in - * other situations is discouraged. This method is - * overridable, but overridden versions must invoke {@code super} - * implementation to maintain guarantees. - * - * @param value the result value for this task - */ - public void complete(V value) { - try { - setRawResult(value); - } catch (Throwable rex) { - setDoneExceptionally(rex); - return; - } - setCompletion(NORMAL); - } - - public final V get() throws InterruptedException, ExecutionException { - quietlyJoin(); - return reportFutureResult(); - } - - public final V get(long timeout, TimeUnit unit) - throws InterruptedException, ExecutionException, TimeoutException { - long nanos = unit.toNanos(timeout); - Thread t = Thread.currentThread(); - if (t instanceof ForkJoinWorkerThread) { - ForkJoinWorkerThread w = (ForkJoinWorkerThread) t; - if (!w.unpushTask(this) || !tryExec()) - timedAwaitDone(w, nanos); - } else - externalTimedAwaitDone(nanos); - return reportTimedFutureResult(); - } - - /** - * Possibly executes other tasks until this task {@link #isDone is - * done}, then returns the result of the computation. This method - * may be more efficient than {@code join}, but is only applicable - * when there are no potential dependencies between continuation - * of the current task and that of any other task that might be - * executed while helping. (This usually holds for pure - * divide-and-conquer tasks). - * - *

This method may be invoked only from within {@code - * ForkJoinTask} computations (as may be determined using method - * {@link #inForkJoinPool}). Attempts to invoke in other contexts - * result in exceptions or errors, possibly including {@code - * ClassCastException}. - * - * @return the computed result - */ - public final V helpJoin() { - quietlyHelpJoin(); - return reportResult(); - } - - /** - * Possibly executes other tasks until this task {@link #isDone is - * done}. This method may be useful when processing collections - * of tasks when some have been cancelled or otherwise known to - * have aborted. - * - *

This method may be invoked only from within {@code - * ForkJoinTask} computations (as may be determined using method - * {@link #inForkJoinPool}). Attempts to invoke in other contexts - * result in exceptions or errors, possibly including {@code - * ClassCastException}. - */ - public final void quietlyHelpJoin() { - ForkJoinWorkerThread w = (ForkJoinWorkerThread) Thread.currentThread(); - if (!w.unpushTask(this) || !tryExec()) { - while (status >= 0) { - ForkJoinTask t = w.scanWhileJoining(this); - if (t == null) { - if (status >= 0) - awaitDone(w); - break; - } - t.tryExec(); - } - } - } - - /** - * Joins this task, without returning its result or throwing an - * exception. This method may be useful when processing - * collections of tasks when some have been cancelled or otherwise - * known to have aborted. - */ - public final void quietlyJoin() { - Thread t = Thread.currentThread(); - if (t instanceof ForkJoinWorkerThread) { - ForkJoinWorkerThread w = (ForkJoinWorkerThread) t; - if (!w.unpushTask(this) || !tryExec()) - awaitDone(w); - } else - externalAwaitDone(); - } - - /** - * Commences performing this task and awaits its completion if - * necessary, without returning its result or throwing an - * exception. This method may be useful when processing - * collections of tasks when some have been cancelled or otherwise - * known to have aborted. - */ - public final void quietlyInvoke() { - if (!tryExec()) - quietlyJoin(); - } - - /** - * Possibly executes tasks until the pool hosting the current task - * {@link ForkJoinPool#isQuiescent is quiescent}. This method may - * be of use in designs in which many tasks are forked, but none - * are explicitly joined, instead executing them until all are - * processed. - * - *

This method may be invoked only from within {@code - * ForkJoinTask} computations (as may be determined using method - * {@link #inForkJoinPool}). Attempts to invoke in other contexts - * result in exceptions or errors, possibly including {@code - * ClassCastException}. - */ - public static void helpQuiesce() { - ((ForkJoinWorkerThread) Thread.currentThread()) - .helpQuiescePool(); - } - - /** - * Resets the internal bookkeeping state of this task, allowing a - * subsequent {@code fork}. This method allows repeated reuse of - * this task, but only if reuse occurs when this task has either - * never been forked, or has been forked, then completed and all - * outstanding joins of this task have also completed. Effects - * under any other usage conditions are not guaranteed. - * This method may be useful when executing - * pre-constructed trees of subtasks in loops. - */ - public void reinitialize() { - if ((status & COMPLETION_MASK) == EXCEPTIONAL) - exceptionMap.remove(this); - status = 0; - } - - /** - * Returns the pool hosting the current task execution, or null - * if this task is executing outside of any ForkJoinPool. - * - * @return the pool, or {@code null} if none - * @see #inForkJoinPool - */ - public static ForkJoinPool getPool() { - Thread t = Thread.currentThread(); - return (t instanceof ForkJoinWorkerThread) ? - ((ForkJoinWorkerThread) t).pool : null; - } - - /** - * Returns {@code true} if the current thread is executing as a - * ForkJoinPool computation. - * - * @return {@code true} if the current thread is executing as a - * ForkJoinPool computation, or false otherwise - */ - public static boolean inForkJoinPool() { - return Thread.currentThread() instanceof ForkJoinWorkerThread; - } - - /** - * Tries to unschedule this task for execution. This method will - * typically succeed if this task is the most recently forked task - * by the current thread, and has not commenced executing in - * another thread. This method may be useful when arranging - * alternative local processing of tasks that could have been, but - * were not, stolen. - * - *

This method may be invoked only from within {@code - * ForkJoinTask} computations (as may be determined using method - * {@link #inForkJoinPool}). Attempts to invoke in other contexts - * result in exceptions or errors, possibly including {@code - * ClassCastException}. - * - * @return {@code true} if unforked - */ - public boolean tryUnfork() { - return ((ForkJoinWorkerThread) Thread.currentThread()) - .unpushTask(this); - } - - /** - * Returns an estimate of the number of tasks that have been - * forked by the current worker thread but not yet executed. This - * value may be useful for heuristic decisions about whether to - * fork other tasks. - * - *

This method may be invoked only from within {@code - * ForkJoinTask} computations (as may be determined using method - * {@link #inForkJoinPool}). Attempts to invoke in other contexts - * result in exceptions or errors, possibly including {@code - * ClassCastException}. - * - * @return the number of tasks - */ - public static int getQueuedTaskCount() { - return ((ForkJoinWorkerThread) Thread.currentThread()) - .getQueueSize(); - } - - /** - * Returns an estimate of how many more locally queued tasks are - * held by the current worker thread than there are other worker - * threads that might steal them. This value may be useful for - * heuristic decisions about whether to fork other tasks. In many - * usages of ForkJoinTasks, at steady state, each worker should - * aim to maintain a small constant surplus (for example, 3) of - * tasks, and to process computations locally if this threshold is - * exceeded. - * - *

This method may be invoked only from within {@code - * ForkJoinTask} computations (as may be determined using method - * {@link #inForkJoinPool}). Attempts to invoke in other contexts - * result in exceptions or errors, possibly including {@code - * ClassCastException}. - * - * @return the surplus number of tasks, which may be negative - */ - public static int getSurplusQueuedTaskCount() { - return ((ForkJoinWorkerThread) Thread.currentThread()) - .getEstimatedSurplusTaskCount(); - } - - // Extension methods - - /** - * Returns the result that would be returned by {@link #join}, even - * if this task completed abnormally, or {@code null} if this task - * is not known to have been completed. This method is designed - * to aid debugging, as well as to support extensions. Its use in - * any other context is discouraged. - * - * @return the result, or {@code null} if not completed - */ - public abstract V getRawResult(); - - /** - * Forces the given value to be returned as a result. This method - * is designed to support extensions, and should not in general be - * called otherwise. - * - * @param value the value - */ - protected abstract void setRawResult(V value); - - /** - * Immediately performs the base action of this task. This method - * is designed to support extensions, and should not in general be - * called otherwise. The return value controls whether this task - * is considered to be done normally. It may return false in - * asynchronous actions that require explicit invocations of - * {@link #complete} to become joinable. It may also throw an - * (unchecked) exception to indicate abnormal exit. - * - * @return {@code true} if completed normally - */ - protected abstract boolean exec(); - - /** - * Returns, but does not unschedule or execute, a task queued by - * the current thread but not yet executed, if one is immediately - * available. There is no guarantee that this task will actually - * be polled or executed next. Conversely, this method may return - * null even if a task exists but cannot be accessed without - * contention with other threads. This method is designed - * primarily to support extensions, and is unlikely to be useful - * otherwise. - * - *

This method may be invoked only from within {@code - * ForkJoinTask} computations (as may be determined using method - * {@link #inForkJoinPool}). Attempts to invoke in other contexts - * result in exceptions or errors, possibly including {@code - * ClassCastException}. - * - * @return the next task, or {@code null} if none are available - */ - protected static ForkJoinTask peekNextLocalTask() { - return ((ForkJoinWorkerThread) Thread.currentThread()) - .peekTask(); - } - - /** - * Unschedules and returns, without executing, the next task - * queued by the current thread but not yet executed. This method - * is designed primarily to support extensions, and is unlikely to - * be useful otherwise. - * - *

This method may be invoked only from within {@code - * ForkJoinTask} computations (as may be determined using method - * {@link #inForkJoinPool}). Attempts to invoke in other contexts - * result in exceptions or errors, possibly including {@code - * ClassCastException}. - * - * @return the next task, or {@code null} if none are available - */ - protected static ForkJoinTask pollNextLocalTask() { - return ((ForkJoinWorkerThread) Thread.currentThread()) - .pollLocalTask(); - } - - /** - * Unschedules and returns, without executing, the next task - * queued by the current thread but not yet executed, if one is - * available, or if not available, a task that was forked by some - * other thread, if available. Availability may be transient, so a - * {@code null} result does not necessarily imply quiescence - * of the pool this task is operating in. This method is designed - * primarily to support extensions, and is unlikely to be useful - * otherwise. - * - *

This method may be invoked only from within {@code - * ForkJoinTask} computations (as may be determined using method - * {@link #inForkJoinPool}). Attempts to invoke in other contexts - * result in exceptions or errors, possibly including {@code - * ClassCastException}. - * - * @return a task, or {@code null} if none are available - */ - protected static ForkJoinTask pollTask() { - return ((ForkJoinWorkerThread) Thread.currentThread()) - .pollTask(); - } - - /** - * Adaptor for Runnables. This implements RunnableFuture - * to be compliant with AbstractExecutorService constraints - * when used in ForkJoinPool. - */ - static final class AdaptedRunnable extends ForkJoinTask - implements RunnableFuture { - final Runnable runnable; - final T resultOnCompletion; - T result; - - AdaptedRunnable(Runnable runnable, T result) { - if (runnable == null) throw new NullPointerException(); - this.runnable = runnable; - this.resultOnCompletion = result; - } - - public T getRawResult() { - return result; - } - - public void setRawResult(T v) { - result = v; - } - - public boolean exec() { - runnable.run(); - result = resultOnCompletion; - return true; - } - - public void run() { - invoke(); - } - - private static final long serialVersionUID = 5232453952276885070L; - } - - /** - * Adaptor for Callables - */ - static final class AdaptedCallable extends ForkJoinTask - implements RunnableFuture { - final Callable callable; - T result; - - AdaptedCallable(Callable callable) { - if (callable == null) throw new NullPointerException(); - this.callable = callable; - } - - public T getRawResult() { - return result; - } - - public void setRawResult(T v) { - result = v; - } - - public boolean exec() { - try { - result = callable.call(); - return true; - } catch (Error err) { - throw err; - } catch (RuntimeException rex) { - throw rex; - } catch (Exception ex) { - throw new RuntimeException(ex); - } - } - - public void run() { - invoke(); - } - - private static final long serialVersionUID = 2838392045355241008L; - } - - /** - * Returns a new {@code ForkJoinTask} that performs the {@code run} - * method of the given {@code Runnable} as its action, and returns - * a null result upon {@link #join}. - * - * @param runnable the runnable action - * @return the task - */ - public static ForkJoinTask adapt(Runnable runnable) { - return new AdaptedRunnable(runnable, null); - } - - /** - * Returns a new {@code ForkJoinTask} that performs the {@code run} - * method of the given {@code Runnable} as its action, and returns - * the given result upon {@link #join}. - * - * @param runnable the runnable action - * @param result the result upon completion - * @return the task - */ - public static ForkJoinTask adapt(Runnable runnable, T result) { - return new AdaptedRunnable(runnable, result); - } - - /** - * Returns a new {@code ForkJoinTask} that performs the {@code call} - * method of the given {@code Callable} as its action, and returns - * its result upon {@link #join}, translating any checked exceptions - * encountered into {@code RuntimeException}. - * - * @param callable the callable action - * @return the task - */ - public static ForkJoinTask adapt(Callable callable) { - return new AdaptedCallable(callable); - } - - // Serialization support - - private static final long serialVersionUID = -7721805057305804111L; - - /** - * Saves the state to a stream. - * - * @param s the stream - * @serialData the current run status and the exception thrown - * during execution, or {@code null} if none - */ - private void writeObject(java.io.ObjectOutputStream s) - throws java.io.IOException { - s.defaultWriteObject(); - s.writeObject(getException()); - } - - /** - * Reconstitutes the instance from a stream. - * - * @param s the stream - */ - private void readObject(java.io.ObjectInputStream s) - throws java.io.IOException, ClassNotFoundException { - s.defaultReadObject(); - status &= ~INTERNAL_SIGNAL_MASK; // clear internal signal counts - status |= EXTERNAL_SIGNAL; // conservatively set external signal - Object ex = s.readObject(); - if (ex != null) - setDoneExceptionally((Throwable) ex); - } - - // Unsafe mechanics - - private static final sun.misc.Unsafe UNSAFE = getUnsafe(); - private static final long statusOffset = - objectFieldOffset("status", ForkJoinTask.class); - - private static long objectFieldOffset(String field, Class klazz) { - try { - return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field)); - } catch (NoSuchFieldException e) { - // Convert Exception to corresponding Error - NoSuchFieldError error = new NoSuchFieldError(field); - error.initCause(e); - throw error; - } - } - - /** - * Returns a sun.misc.Unsafe. Suitable for use in a 3rd party package. - * Replace with a simple call to Unsafe.getUnsafe when integrating - * into a jdk. - * - * @return a sun.misc.Unsafe - */ - private static sun.misc.Unsafe getUnsafe() { - try { - return sun.misc.Unsafe.getUnsafe(); - } catch (SecurityException se) { - try { - return java.security.AccessController.doPrivileged - (new java.security - .PrivilegedExceptionAction() { - public sun.misc.Unsafe run() throws Exception { - java.lang.reflect.Field f = sun.misc - .Unsafe.class.getDeclaredField("theUnsafe"); - f.setAccessible(true); - return (sun.misc.Unsafe) f.get(null); - } - }); - } catch (java.security.PrivilegedActionException e) { - throw new RuntimeException("Could not initialize intrinsics", - e.getCause()); - } - } - } -} diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/ForkJoinWorkerThread.java b/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/ForkJoinWorkerThread.java deleted file mode 100644 index 5ebb0f54d22..00000000000 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/ForkJoinWorkerThread.java +++ /dev/null @@ -1,1060 +0,0 @@ -/* - * Licensed to Elastic Search and Shay Banon under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. Elastic Search 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. - */ - -/* - * Written by Doug Lea with assistance from members of JCP JSR-166 - * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain - */ - -package org.elasticsearch.util.concurrent.jsr166y; - -import java.util.Collection; -import java.util.Random; -import java.util.concurrent.RejectedExecutionException; -import java.util.concurrent.locks.LockSupport; - -/** - * A thread managed by a {@link ForkJoinPool}. This class is - * subclassable solely for the sake of adding functionality -- there - * are no overridable methods dealing with scheduling or execution. - * However, you can override initialization and termination methods - * surrounding the main task processing loop. If you do create such a - * subclass, you will also need to supply a custom {@link - * ForkJoinPool.ForkJoinWorkerThreadFactory} to use it in a {@code - * ForkJoinPool}. - * - * @author Doug Lea - * @since 1.7 - */ -public class ForkJoinWorkerThread extends Thread { - /* - * Overview: - * - * ForkJoinWorkerThreads are managed by ForkJoinPools and perform - * ForkJoinTasks. This class includes bookkeeping in support of - * worker activation, suspension, and lifecycle control described - * in more detail in the internal documentation of class - * ForkJoinPool. And as described further below, this class also - * includes special-cased support for some ForkJoinTask - * methods. But the main mechanics involve work-stealing: - * - * Work-stealing queues are special forms of Deques that support - * only three of the four possible end-operations -- push, pop, - * and deq (aka steal), under the further constraints that push - * and pop are called only from the owning thread, while deq may - * be called from other threads. (If you are unfamiliar with - * them, you probably want to read Herlihy and Shavit's book "The - * Art of Multiprocessor programming", chapter 16 describing these - * in more detail before proceeding.) The main work-stealing - * queue design is roughly similar to those in the papers "Dynamic - * Circular Work-Stealing Deque" by Chase and Lev, SPAA 2005 - * (http://research.sun.com/scalable/pubs/index.html) and - * "Idempotent work stealing" by Michael, Saraswat, and Vechev, - * PPoPP 2009 (http://portal.acm.org/citation.cfm?id=1504186). - * The main differences ultimately stem from gc requirements that - * we null out taken slots as soon as we can, to maintain as small - * a footprint as possible even in programs generating huge - * numbers of tasks. To accomplish this, we shift the CAS - * arbitrating pop vs deq (steal) from being on the indices - * ("base" and "sp") to the slots themselves (mainly via method - * "casSlotNull()"). So, both a successful pop and deq mainly - * entail a CAS of a slot from non-null to null. Because we rely - * on CASes of references, we do not need tag bits on base or sp. - * They are simple ints as used in any circular array-based queue - * (see for example ArrayDeque). Updates to the indices must - * still be ordered in a way that guarantees that sp == base means - * the queue is empty, but otherwise may err on the side of - * possibly making the queue appear nonempty when a push, pop, or - * deq have not fully committed. Note that this means that the deq - * operation, considered individually, is not wait-free. One thief - * cannot successfully continue until another in-progress one (or, - * if previously empty, a push) completes. However, in the - * aggregate, we ensure at least probabilistic non-blockingness. - * If an attempted steal fails, a thief always chooses a different - * random victim target to try next. So, in order for one thief to - * progress, it suffices for any in-progress deq or new push on - * any empty queue to complete. One reason this works well here is - * that apparently-nonempty often means soon-to-be-stealable, - * which gives threads a chance to set activation status if - * necessary before stealing. - * - * This approach also enables support for "async mode" where local - * task processing is in FIFO, not LIFO order; simply by using a - * version of deq rather than pop when locallyFifo is true (as set - * by the ForkJoinPool). This allows use in message-passing - * frameworks in which tasks are never joined. - * - * Efficient implementation of this approach currently relies on - * an uncomfortable amount of "Unsafe" mechanics. To maintain - * correct orderings, reads and writes of variable base require - * volatile ordering. Variable sp does not require volatile - * writes but still needs store-ordering, which we accomplish by - * pre-incrementing sp before filling the slot with an ordered - * store. (Pre-incrementing also enables backouts used in - * scanWhileJoining.) Because they are protected by volatile base - * reads, reads of the queue array and its slots by other threads - * do not need volatile load semantics, but writes (in push) - * require store order and CASes (in pop and deq) require - * (volatile) CAS semantics. (Michael, Saraswat, and Vechev's - * algorithm has similar properties, but without support for - * nulling slots.) Since these combinations aren't supported - * using ordinary volatiles, the only way to accomplish these - * efficiently is to use direct Unsafe calls. (Using external - * AtomicIntegers and AtomicReferenceArrays for the indices and - * array is significantly slower because of memory locality and - * indirection effects.) - * - * Further, performance on most platforms is very sensitive to - * placement and sizing of the (resizable) queue array. Even - * though these queues don't usually become all that big, the - * initial size must be large enough to counteract cache - * contention effects across multiple queues (especially in the - * presence of GC cardmarking). Also, to improve thread-locality, - * queues are initialized after starting. All together, these - * low-level implementation choices produce as much as a factor of - * 4 performance improvement compared to naive implementations, - * and enable the processing of billions of tasks per second, - * sometimes at the expense of ugliness. - */ - - /** - * Generator for initial random seeds for random victim - * selection. This is used only to create initial seeds. Random - * steals use a cheaper xorshift generator per steal attempt. We - * expect only rare contention on seedGenerator, so just use a - * plain Random. - */ - private static final Random seedGenerator = new Random(); - - /** - * The timeout value for suspending spares. Spare workers that - * remain unsignalled for more than this time may be trimmed - * (killed and removed from pool). Since our goal is to avoid - * long-term thread buildup, the exact value of timeout does not - * matter too much so long as it avoids most false-alarm timeouts - * under GC stalls or momentarily high system load. - */ - private static final long SPARE_KEEPALIVE_NANOS = - 5L * 1000L * 1000L * 1000L; // 5 secs - - /** - * Capacity of work-stealing queue array upon initialization. - * Must be a power of two. Initial size must be at least 2, but is - * padded to minimize cache effects. - */ - private static final int INITIAL_QUEUE_CAPACITY = 1 << 13; - - /** - * Maximum work-stealing queue array size. Must be less than or - * equal to 1 << 28 to ensure lack of index wraparound. (This - * is less than usual bounds, because we need leftshift by 3 - * to be in int range). - */ - private static final int MAXIMUM_QUEUE_CAPACITY = 1 << 28; - - /** - * The pool this thread works in. Accessed directly by ForkJoinTask. - */ - final ForkJoinPool pool; - - /** - * The work-stealing queue array. Size must be a power of two. - * Initialized in onStart, to improve memory locality. - */ - private ForkJoinTask[] queue; - - /** - * Index (mod queue.length) of least valid queue slot, which is - * always the next position to steal from if nonempty. - */ - private volatile int base; - - /** - * Index (mod queue.length) of next queue slot to push to or pop - * from. It is written only by owner thread, and accessed by other - * threads only after reading (volatile) base. Both sp and base - * are allowed to wrap around on overflow, but (sp - base) still - * estimates size. - */ - private int sp; - - /** - * Run state of this worker. In addition to the usual run levels, - * tracks if this worker is suspended as a spare, and if it was - * killed (trimmed) while suspended. However, "active" status is - * maintained separately. - */ - private volatile int runState; - - private static final int TERMINATING = 0x01; - private static final int TERMINATED = 0x02; - private static final int SUSPENDED = 0x04; // inactive spare - private static final int TRIMMED = 0x08; // killed while suspended - - /** - * Number of LockSupport.park calls to block this thread for - * suspension or event waits. Used for internal instrumention; - * currently not exported but included because volatile write upon - * park also provides a workaround for a JVM bug. - */ - private volatile int parkCount; - - /** - * Number of steals, transferred and reset in pool callbacks pool - * when idle Accessed directly by pool. - */ - int stealCount; - - /** - * Seed for random number generator for choosing steal victims. - * Uses Marsaglia xorshift. Must be initialized as nonzero. - */ - private int seed; - - /** - * Activity status. When true, this worker is considered active. - * Accessed directly by pool. Must be false upon construction. - */ - boolean active; - - /** - * True if use local fifo, not default lifo, for local polling. - * Shadows value from ForkJoinPool, which resets it if changed - * pool-wide. - */ - private boolean locallyFifo; - - /** - * Index of this worker in pool array. Set once by pool before - * running, and accessed directly by pool to locate this worker in - * its workers array. - */ - int poolIndex; - - /** - * The last pool event waited for. Accessed only by pool in - * callback methods invoked within this thread. - */ - int lastEventCount; - - /** - * Encoded index and event count of next event waiter. Used only - * by ForkJoinPool for managing event waiters. - */ - volatile long nextWaiter; - - /** - * Creates a ForkJoinWorkerThread operating in the given pool. - * - * @param pool the pool this thread works in - * @throws NullPointerException if pool is null - */ - protected ForkJoinWorkerThread(ForkJoinPool pool) { - if (pool == null) throw new NullPointerException(); - this.pool = pool; - // To avoid exposing construction details to subclasses, - // remaining initialization is in start() and onStart() - } - - /** - * Performs additional initialization and starts this thread - */ - final void start(int poolIndex, boolean locallyFifo, - UncaughtExceptionHandler ueh) { - this.poolIndex = poolIndex; - this.locallyFifo = locallyFifo; - if (ueh != null) - setUncaughtExceptionHandler(ueh); - setDaemon(true); - start(); - } - - // Public/protected methods - - /** - * Returns the pool hosting this thread. - * - * @return the pool - */ - public ForkJoinPool getPool() { - return pool; - } - - /** - * Returns the index number of this thread in its pool. The - * returned value ranges from zero to the maximum number of - * threads (minus one) that have ever been created in the pool. - * This method may be useful for applications that track status or - * collect results per-worker rather than per-task. - * - * @return the index number - */ - public int getPoolIndex() { - return poolIndex; - } - - /** - * Initializes internal state after construction but before - * processing any tasks. If you override this method, you must - * invoke super.onStart() at the beginning of the method. - * Initialization requires care: Most fields must have legal - * default values, to ensure that attempted accesses from other - * threads work correctly even before this thread starts - * processing tasks. - */ - protected void onStart() { - int rs = seedGenerator.nextInt(); - seed = rs == 0 ? 1 : rs; // seed must be nonzero - - // Allocate name string and queue array in this thread - String pid = Integer.toString(pool.getPoolNumber()); - String wid = Integer.toString(poolIndex); - setName("ForkJoinPool-" + pid + "-worker-" + wid); - - queue = new ForkJoinTask[INITIAL_QUEUE_CAPACITY]; - } - - /** - * Performs cleanup associated with termination of this worker - * thread. If you override this method, you must invoke - * {@code super.onTermination} at the end of the overridden method. - * - * @param exception the exception causing this thread to abort due - * to an unrecoverable error, or {@code null} if completed normally - */ - protected void onTermination(Throwable exception) { - try { - cancelTasks(); - setTerminated(); - pool.workerTerminated(this); - } catch (Throwable ex) { // Shouldn't ever happen - if (exception == null) // but if so, at least rethrown - exception = ex; - } finally { - if (exception != null) - UNSAFE.throwException(exception); - } - } - - /** - * This method is required to be public, but should never be - * called explicitly. It performs the main run loop to execute - * ForkJoinTasks. - */ - public void run() { - Throwable exception = null; - try { - onStart(); - mainLoop(); - } catch (Throwable ex) { - exception = ex; - } finally { - onTermination(exception); - } - } - - // helpers for run() - - /** - * Find and execute tasks and check status while running - */ - private void mainLoop() { - boolean ran = false; // true if ran task on previous step - ForkJoinPool p = pool; - for (; ;) { - p.preStep(this, ran); - if (runState != 0) - return; - ForkJoinTask t; // try to get and run stolen or submitted task - if (ran = (t = scan()) != null || (t = pollSubmission()) != null) { - t.tryExec(); - if (base != sp) - runLocalTasks(); - } - } - } - - /** - * Runs local tasks until queue is empty or shut down. Call only - * while active. - */ - private void runLocalTasks() { - while (runState == 0) { - ForkJoinTask t = locallyFifo ? locallyDeqTask() : popTask(); - if (t != null) - t.tryExec(); - else if (base == sp) - break; - } - } - - /** - * If a submission exists, try to activate and take it - * - * @return a task, if available - */ - private ForkJoinTask pollSubmission() { - ForkJoinPool p = pool; - while (p.hasQueuedSubmissions()) { - if (active || (active = p.tryIncrementActiveCount())) { - ForkJoinTask t = p.pollSubmission(); - return t != null ? t : scan(); // if missed, rescan - } - } - return null; - } - - /* - * Intrinsics-based atomic writes for queue slots. These are - * basically the same as methods in AtomicObjectArray, but - * specialized for (1) ForkJoinTask elements (2) requirement that - * nullness and bounds checks have already been performed by - * callers and (3) effective offsets are known not to overflow - * from int to long (because of MAXIMUM_QUEUE_CAPACITY). We don't - * need corresponding version for reads: plain array reads are OK - * because they protected by other volatile reads and are - * confirmed by CASes. - * - * Most uses don't actually call these methods, but instead contain - * inlined forms that enable more predictable optimization. We - * don't define the version of write used in pushTask at all, but - * instead inline there a store-fenced array slot write. - */ - - /** - * CASes slot i of array q from t to null. Caller must ensure q is - * non-null and index is in range. - */ - private static final boolean casSlotNull(ForkJoinTask[] q, int i, - ForkJoinTask t) { - return UNSAFE.compareAndSwapObject(q, (i << qShift) + qBase, t, null); - } - - /** - * Performs a volatile write of the given task at given slot of - * array q. Caller must ensure q is non-null and index is in - * range. This method is used only during resets and backouts. - */ - private static final void writeSlot(ForkJoinTask[] q, int i, - ForkJoinTask t) { - UNSAFE.putObjectVolatile(q, (i << qShift) + qBase, t); - } - - // queue methods - - /** - * Pushes a task. Call only from this thread. - * - * @param t the task. Caller must ensure non-null. - */ - final void pushTask(ForkJoinTask t) { - int s; - ForkJoinTask[] q = queue; - int mask = q.length - 1; // implicit assert q != null - UNSAFE.putOrderedObject(q, (((s = sp++) & mask) << qShift) + qBase, t); - if ((s -= base) <= 0) - pool.signalWork(); - else if (s + 1 >= mask) - growQueue(); - } - - /** - * Tries to take a task from the base of the queue, failing if - * empty or contended. Note: Specializations of this code appear - * in scan and scanWhileJoining. - * - * @return a task, or null if none or contended - */ - final ForkJoinTask deqTask() { - ForkJoinTask t; - ForkJoinTask[] q; - int b, i; - if ((b = base) != sp && - (q = queue) != null && // must read q after b - (t = q[i = (q.length - 1) & b]) != null && - UNSAFE.compareAndSwapObject(q, (i << qShift) + qBase, t, null)) { - base = b + 1; - return t; - } - return null; - } - - /** - * Tries to take a task from the base of own queue. Assumes active - * status. Called only by current thread. - * - * @return a task, or null if none - */ - final ForkJoinTask locallyDeqTask() { - ForkJoinTask[] q = queue; - if (q != null) { - ForkJoinTask t; - int b, i; - while (sp != (b = base)) { - if ((t = q[i = (q.length - 1) & b]) != null && - UNSAFE.compareAndSwapObject(q, (i << qShift) + qBase, - t, null)) { - base = b + 1; - return t; - } - } - } - return null; - } - - /** - * Returns a popped task, or null if empty. Assumes active status. - * Called only by current thread. (Note: a specialization of this - * code appears in scanWhileJoining.) - */ - final ForkJoinTask popTask() { - int s; - ForkJoinTask[] q = queue; - if (q != null && (s = sp) != base) { - int i = (q.length - 1) & --s; - ForkJoinTask t = q[i]; - if (t != null && UNSAFE.compareAndSwapObject - (q, (i << qShift) + qBase, t, null)) { - sp = s; - return t; - } - } - return null; - } - - /** - * Specialized version of popTask to pop only if - * topmost element is the given task. Called only - * by current thread while active. - * - * @param t the task. Caller must ensure non-null. - */ - final boolean unpushTask(ForkJoinTask t) { - int s; - ForkJoinTask[] q = queue; - if (q != null && UNSAFE.compareAndSwapObject - (q, (((q.length - 1) & (s = sp - 1)) << qShift) + qBase, t, null)) { - sp = s; - return true; - } - return false; - } - - /** - * Returns next task or null if empty or contended - */ - final ForkJoinTask peekTask() { - ForkJoinTask[] q = queue; - if (q == null) - return null; - int mask = q.length - 1; - int i = locallyFifo ? base : (sp - 1); - return q[i & mask]; - } - - /** - * Doubles queue array size. Transfers elements by emulating - * steals (deqs) from old array and placing, oldest first, into - * new array. - */ - private void growQueue() { - ForkJoinTask[] oldQ = queue; - int oldSize = oldQ.length; - int newSize = oldSize << 1; - if (newSize > MAXIMUM_QUEUE_CAPACITY) - throw new RejectedExecutionException("Queue capacity exceeded"); - ForkJoinTask[] newQ = queue = new ForkJoinTask[newSize]; - - int b = base; - int bf = b + oldSize; - int oldMask = oldSize - 1; - int newMask = newSize - 1; - do { - int oldIndex = b & oldMask; - ForkJoinTask t = oldQ[oldIndex]; - if (t != null && !casSlotNull(oldQ, oldIndex, t)) - t = null; - writeSlot(newQ, b & newMask, t); - } while (++b != bf); - pool.signalWork(); - } - - /** - * Computes next value for random victim probe in scan(). Scans - * don't require a very high quality generator, but also not a - * crummy one. Marsaglia xor-shift is cheap and works well enough. - * Note: This is manually inlined in scan() - */ - private static final int xorShift(int r) { - r ^= r << 13; - r ^= r >>> 17; - return r ^ (r << 5); - } - - /** - * Tries to steal a task from another worker. Starts at a random - * index of workers array, and probes workers until finding one - * with non-empty queue or finding that all are empty. It - * randomly selects the first n probes. If these are empty, it - * resorts to a circular sweep, which is necessary to accurately - * set active status. (The circular sweep uses steps of - * approximately half the array size plus 1, to avoid bias - * stemming from leftmost packing of the array in ForkJoinPool.) - * - * This method must be both fast and quiet -- usually avoiding - * memory accesses that could disrupt cache sharing etc other than - * those needed to check for and take tasks (or to activate if not - * already active). This accounts for, among other things, - * updating random seed in place without storing it until exit. - * - * @return a task, or null if none found - */ - private ForkJoinTask scan() { - ForkJoinPool p = pool; - ForkJoinWorkerThread[] ws = p.workers; - int n = ws.length; // upper bound of #workers - boolean canSteal = active; // shadow active status - int r = seed; // extract seed once - int k = r; // index: random if j<0 else step - for (int j = -n; j < n; ++j) { - ForkJoinWorkerThread v = ws[k & (n - 1)]; - r ^= r << 13; - r ^= r >>> 17; - r ^= r << 5; // xorshift - if (v != null && v.base != v.sp) { - if (canSteal || // ensure active status - (canSteal = active = p.tryIncrementActiveCount())) { - int b, i; // inlined specialization of deqTask - ForkJoinTask t; - ForkJoinTask[] q; - if ((b = v.base) != v.sp && // recheck - (q = v.queue) != null && - (t = q[i = (q.length - 1) & b]) != null && - UNSAFE.compareAndSwapObject - (q, (i << qShift) + qBase, t, null)) { - v.base = b + 1; - seed = r; - ++stealCount; - return t; - } - } - j = -n; // reset on contention - } - k = j >= 0 ? k + ((n >>> 1) | 1) : r; - } - return null; - } - - // Run State management - - // status check methods used mainly by ForkJoinPool - - final boolean isTerminating() { - return (runState & TERMINATING) != 0; - } - - final boolean isTerminated() { - return (runState & TERMINATED) != 0; - } - - final boolean isSuspended() { - return (runState & SUSPENDED) != 0; - } - - final boolean isTrimmed() { - return (runState & TRIMMED) != 0; - } - - /** - * Sets state to TERMINATING, also resuming if suspended. - */ - final void shutdown() { - for (; ;) { - int s = runState; - if ((s & SUSPENDED) != 0) { // kill and wakeup if suspended - if (UNSAFE.compareAndSwapInt(this, runStateOffset, s, - (s & ~SUSPENDED) | - (TRIMMED | TERMINATING))) { - LockSupport.unpark(this); - break; - } - } else if (UNSAFE.compareAndSwapInt(this, runStateOffset, s, - s | TERMINATING)) - break; - } - } - - /** - * Sets state to TERMINATED. Called only by this thread. - */ - private void setTerminated() { - int s; - do { - } while (!UNSAFE.compareAndSwapInt(this, runStateOffset, - s = runState, - s | (TERMINATING | TERMINATED))); - } - - /** - * Instrumented version of park. Also used by ForkJoinPool.awaitEvent - */ - final void doPark() { - ++parkCount; - LockSupport.park(this); - } - - /** - * If suspended, tries to set status to unsuspended. - * Caller must unpark to actually resume - * - * @return true if successful - */ - final boolean tryUnsuspend() { - int s; - return (((s = runState) & SUSPENDED) != 0 && - UNSAFE.compareAndSwapInt(this, runStateOffset, s, - s & ~SUSPENDED)); - } - - /** - * Sets suspended status and blocks as spare until resumed, - * shutdown, or timed out. - * - * @return false if trimmed - */ - final boolean suspendAsSpare() { - for (; ;) { // set suspended unless terminating - int s = runState; - if ((s & TERMINATING) != 0) { // must kill - if (UNSAFE.compareAndSwapInt(this, runStateOffset, s, - s | (TRIMMED | TERMINATING))) - return false; - } else if (UNSAFE.compareAndSwapInt(this, runStateOffset, s, - s | SUSPENDED)) - break; - } - lastEventCount = 0; // reset upon resume - ForkJoinPool p = pool; - p.releaseWaiters(); // help others progress - p.accumulateStealCount(this); - interrupted(); // clear/ignore interrupts - if (poolIndex < p.getParallelism()) { // untimed wait - while ((runState & SUSPENDED) != 0) - doPark(); - return true; - } - return timedSuspend(); // timed wait if apparently non-core - } - - /** - * Blocks as spare until resumed or timed out - * - * @return false if trimmed - */ - private boolean timedSuspend() { - long nanos = SPARE_KEEPALIVE_NANOS; - long startTime = System.nanoTime(); - while ((runState & SUSPENDED) != 0) { - ++parkCount; - if ((nanos -= (System.nanoTime() - startTime)) > 0) - LockSupport.parkNanos(this, nanos); - else { // try to trim on timeout - int s = runState; - if (UNSAFE.compareAndSwapInt(this, runStateOffset, s, - (s & ~SUSPENDED) | - (TRIMMED | TERMINATING))) - return false; - } - } - return true; - } - - // Misc support methods for ForkJoinPool - - /** - * Returns an estimate of the number of tasks in the queue. Also - * used by ForkJoinTask. - */ - final int getQueueSize() { - return -base + sp; - } - - /** - * Set locallyFifo mode. Called only by ForkJoinPool - */ - final void setAsyncMode(boolean async) { - locallyFifo = async; - } - - /** - * Removes and cancels all tasks in queue. Can be called from any - * thread. - */ - final void cancelTasks() { - while (base != sp) { - ForkJoinTask t = deqTask(); - if (t != null) - t.cancelIgnoringExceptions(); - } - } - - /** - * Drains tasks to given collection c. - * - * @return the number of tasks drained - */ - final int drainTasksTo(Collection> c) { - int n = 0; - while (base != sp) { - ForkJoinTask t = deqTask(); - if (t != null) { - c.add(t); - ++n; - } - } - return n; - } - - // Support methods for ForkJoinTask - - /** - * Returns an estimate of the number of tasks, offset by a - * function of number of idle workers. - * - * This method provides a cheap heuristic guide for task - * partitioning when programmers, frameworks, tools, or languages - * have little or no idea about task granularity. In essence by - * offering this method, we ask users only about tradeoffs in - * overhead vs expected throughput and its variance, rather than - * how finely to partition tasks. - * - * In a steady state strict (tree-structured) computation, each - * thread makes available for stealing enough tasks for other - * threads to remain active. Inductively, if all threads play by - * the same rules, each thread should make available only a - * constant number of tasks. - * - * The minimum useful constant is just 1. But using a value of 1 - * would require immediate replenishment upon each steal to - * maintain enough tasks, which is infeasible. Further, - * partitionings/granularities of offered tasks should minimize - * steal rates, which in general means that threads nearer the top - * of computation tree should generate more than those nearer the - * bottom. In perfect steady state, each thread is at - * approximately the same level of computation tree. However, - * producing extra tasks amortizes the uncertainty of progress and - * diffusion assumptions. - * - * So, users will want to use values larger, but not much larger - * than 1 to both smooth over transient shortages and hedge - * against uneven progress; as traded off against the cost of - * extra task overhead. We leave the user to pick a threshold - * value to compare with the results of this call to guide - * decisions, but recommend values such as 3. - * - * When all threads are active, it is on average OK to estimate - * surplus strictly locally. In steady-state, if one thread is - * maintaining say 2 surplus tasks, then so are others. So we can - * just use estimated queue length (although note that (sp - base) - * can be an overestimate because of stealers lagging increments - * of base). However, this strategy alone leads to serious - * mis-estimates in some non-steady-state conditions (ramp-up, - * ramp-down, other stalls). We can detect many of these by - * further considering the number of "idle" threads, that are - * known to have zero queued tasks, so compensate by a factor of - * (#idle/#active) threads. - */ - final int getEstimatedSurplusTaskCount() { - return sp - base - pool.idlePerActive(); - } - - /** - * Gets and removes a local task. - * - * @return a task, if available - */ - final ForkJoinTask pollLocalTask() { - while (base != sp) { - if (active || (active = pool.tryIncrementActiveCount())) - return locallyFifo ? locallyDeqTask() : popTask(); - } - return null; - } - - /** - * Gets and removes a local or stolen task. - * - * @return a task, if available - */ - final ForkJoinTask pollTask() { - ForkJoinTask t; - return (t = pollLocalTask()) != null ? t : scan(); - } - - /** - * Returns a stolen task, if available, unless joinMe is done - * - * This method is intrinsically nonmodular. To maintain the - * property that tasks are never stolen if the awaited task is - * ready, we must interleave mechanics of scan with status - * checks. We rely here on the commit points of deq that allow us - * to cancel a steal even after CASing slot to null, but before - * adjusting base index: If, after the CAS, we see that joinMe is - * ready, we can back out by placing the task back into the slot, - * without adjusting index. The scan loop is otherwise the same as - * in scan. - * - * The outer loop cannot be allowed to run forever, because it - * could lead to a form of deadlock if all threads are executing - * this method. However, we must also be patient before giving up, - * to cope with GC stalls, transient high loads, etc. The loop - * terminates (causing caller to possibly block this thread and - * create a replacement) only after #workers clean sweeps during - * which all running threads are active. - */ - final ForkJoinTask scanWhileJoining(ForkJoinTask joinMe) { - int sweeps = 0; - int r = seed; - ForkJoinPool p = pool; - p.releaseWaiters(); // help other threads progress - while (joinMe.status >= 0) { - ForkJoinWorkerThread[] ws = p.workers; - int n = ws.length; - int k = r; - for (int j = -n; j < n; ++j) { - ForkJoinWorkerThread v = ws[k & (n - 1)]; - r ^= r << 13; - r ^= r >>> 17; - r ^= r << 5; // xorshift - if (v != null) { - int b = v.base; - ForkJoinTask[] q; - if (b != v.sp && (q = v.queue) != null) { - int i = (q.length - 1) & b; - ForkJoinTask t = q[i]; - if (t != null) { - if (joinMe.status < 0) - return null; - if (UNSAFE.compareAndSwapObject - (q, (i << qShift) + qBase, t, null)) { - if (joinMe.status < 0) { - writeSlot(q, i, t); // back out - return null; - } - v.base = b + 1; - seed = r; - ++stealCount; - return t; - } - } - sweeps = 0; // ensure rescan on contention - } - } - k = j >= 0 ? k + ((n >>> 1) | 1) : r; - if ((j & 7) == 0 && joinMe.status < 0) // periodically recheck - return null; - } - if ((sweeps = p.inactiveCount() == 0 ? sweeps + 1 : 0) > n) - return null; - } - return null; - } - - /** - * Runs tasks until {@code pool.isQuiescent()}. - */ - final void helpQuiescePool() { - for (; ;) { - ForkJoinTask t = pollLocalTask(); - if (t != null || (t = scan()) != null) - t.tryExec(); - else { - ForkJoinPool p = pool; - if (active) { - active = false; // inactivate - do { - } while (!p.tryDecrementActiveCount()); - } - if (p.isQuiescent()) { - active = true; // re-activate - do { - } while (!p.tryIncrementActiveCount()); - return; - } - } - } - } - - // Unsafe mechanics - - private static final sun.misc.Unsafe UNSAFE = getUnsafe(); - private static final long runStateOffset = - objectFieldOffset("runState", ForkJoinWorkerThread.class); - private static final long qBase = - UNSAFE.arrayBaseOffset(ForkJoinTask[].class); - private static final int qShift; - - static { - int s = UNSAFE.arrayIndexScale(ForkJoinTask[].class); - if ((s & (s - 1)) != 0) - throw new Error("data type scale not a power of two"); - qShift = 31 - Integer.numberOfLeadingZeros(s); - } - - private static long objectFieldOffset(String field, Class klazz) { - try { - return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field)); - } catch (NoSuchFieldException e) { - // Convert Exception to corresponding Error - NoSuchFieldError error = new NoSuchFieldError(field); - error.initCause(e); - throw error; - } - } - - /** - * Returns a sun.misc.Unsafe. Suitable for use in a 3rd party package. - * Replace with a simple call to Unsafe.getUnsafe when integrating - * into a jdk. - * - * @return a sun.misc.Unsafe - */ - private static sun.misc.Unsafe getUnsafe() { - try { - return sun.misc.Unsafe.getUnsafe(); - } catch (SecurityException se) { - try { - return java.security.AccessController.doPrivileged - (new java.security - .PrivilegedExceptionAction() { - public sun.misc.Unsafe run() throws Exception { - java.lang.reflect.Field f = sun.misc - .Unsafe.class.getDeclaredField("theUnsafe"); - f.setAccessible(true); - return (sun.misc.Unsafe) f.get(null); - } - }); - } catch (java.security.PrivilegedActionException e) { - throw new RuntimeException("Could not initialize intrinsics", - e.getCause()); - } - } - } -} diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/LinkedTransferQueue.java b/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/LinkedTransferQueue.java deleted file mode 100644 index aa9639e1995..00000000000 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/LinkedTransferQueue.java +++ /dev/null @@ -1,1287 +0,0 @@ -/* - * Licensed to Elastic Search and Shay Banon under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. Elastic Search 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. - */ - -/* - * Written by Doug Lea with assistance from members of JCP JSR-166 - * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain - */ - -package org.elasticsearch.util.concurrent.jsr166y; - -import java.util.*; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.locks.LockSupport; - -/** - * An unbounded {@link TransferQueue} based on linked nodes. - * This queue orders elements FIFO (first-in-first-out) with respect - * to any given producer. The head of the queue is that - * element that has been on the queue the longest time for some - * producer. The tail of the queue is that element that has - * been on the queue the shortest time for some producer. - * - *

Beware that, unlike in most collections, the {@code size} - * method is NOT a constant-time operation. Because of the - * asynchronous nature of these queues, determining the current number - * of elements requires a traversal of the elements. - * - *

This class and its iterator implement all of the - * optional methods of the {@link Collection} and {@link - * Iterator} interfaces. - * - *

Memory consistency effects: As with other concurrent - * collections, actions in a thread prior to placing an object into a - * {@code LinkedTransferQueue} - * happen-before - * actions subsequent to the access or removal of that element from - * the {@code LinkedTransferQueue} in another thread. - * - *

This class is a member of the - * - * Java Collections Framework. - * - * @author Doug Lea - * @param the type of elements held in this collection - * @since 1.7 - */ -public class LinkedTransferQueue extends AbstractQueue - implements TransferQueue, java.io.Serializable { - private static final long serialVersionUID = -3223113410248163686L; - - /* - * *** Overview of Dual Queues with Slack *** - * - * Dual Queues, introduced by Scherer and Scott - * (http://www.cs.rice.edu/~wns1/papers/2004-DISC-DDS.pdf) are - * (linked) queues in which nodes may represent either data or - * requests. When a thread tries to enqueue a data node, but - * encounters a request node, it instead "matches" and removes it; - * and vice versa for enqueuing requests. Blocking Dual Queues - * arrange that threads enqueuing unmatched requests block until - * other threads provide the match. Dual Synchronous Queues (see - * Scherer, Lea, & Scott - * http://www.cs.rochester.edu/u/scott/papers/2009_Scherer_CACM_SSQ.pdf) - * additionally arrange that threads enqueuing unmatched data also - * block. Dual Transfer Queues support all of these modes, as - * dictated by callers. - * - * A FIFO dual queue may be implemented using a variation of the - * Michael & Scott (M&S) lock-free queue algorithm - * (http://www.cs.rochester.edu/u/scott/papers/1996_PODC_queues.pdf). - * It maintains two pointer fields, "head", pointing to a - * (matched) node that in turn points to the first actual - * (unmatched) queue node (or null if empty); and "tail" that - * points to the last node on the queue (or again null if - * empty). For example, here is a possible queue with four data - * elements: - * - * head tail - * | | - * v v - * M -> U -> U -> U -> U - * - * The M&S queue algorithm is known to be prone to scalability and - * overhead limitations when maintaining (via CAS) these head and - * tail pointers. This has led to the development of - * contention-reducing variants such as elimination arrays (see - * Moir et al http://portal.acm.org/citation.cfm?id=1074013) and - * optimistic back pointers (see Ladan-Mozes & Shavit - * http://people.csail.mit.edu/edya/publications/OptimisticFIFOQueue-journal.pdf). - * However, the nature of dual queues enables a simpler tactic for - * improving M&S-style implementations when dual-ness is needed. - * - * In a dual queue, each node must atomically maintain its match - * status. While there are other possible variants, we implement - * this here as: for a data-mode node, matching entails CASing an - * "item" field from a non-null data value to null upon match, and - * vice-versa for request nodes, CASing from null to a data - * value. (Note that the linearization properties of this style of - * queue are easy to verify -- elements are made available by - * linking, and unavailable by matching.) Compared to plain M&S - * queues, this property of dual queues requires one additional - * successful atomic operation per enq/deq pair. But it also - * enables lower cost variants of queue maintenance mechanics. (A - * variation of this idea applies even for non-dual queues that - * support deletion of interior elements, such as - * j.u.c.ConcurrentLinkedQueue.) - * - * Once a node is matched, its match status can never again - * change. We may thus arrange that the linked list of them - * contain a prefix of zero or more matched nodes, followed by a - * suffix of zero or more unmatched nodes. (Note that we allow - * both the prefix and suffix to be zero length, which in turn - * means that we do not use a dummy header.) If we were not - * concerned with either time or space efficiency, we could - * correctly perform enqueue and dequeue operations by traversing - * from a pointer to the initial node; CASing the item of the - * first unmatched node on match and CASing the next field of the - * trailing node on appends. (Plus some special-casing when - * initially empty). While this would be a terrible idea in - * itself, it does have the benefit of not requiring ANY atomic - * updates on head/tail fields. - * - * We introduce here an approach that lies between the extremes of - * never versus always updating queue (head and tail) pointers. - * This offers a tradeoff between sometimes requiring extra - * traversal steps to locate the first and/or last unmatched - * nodes, versus the reduced overhead and contention of fewer - * updates to queue pointers. For example, a possible snapshot of - * a queue is: - * - * head tail - * | | - * v v - * M -> M -> U -> U -> U -> U - * - * The best value for this "slack" (the targeted maximum distance - * between the value of "head" and the first unmatched node, and - * similarly for "tail") is an empirical matter. We have found - * that using very small constants in the range of 1-3 work best - * over a range of platforms. Larger values introduce increasing - * costs of cache misses and risks of long traversal chains, while - * smaller values increase CAS contention and overhead. - * - * Dual queues with slack differ from plain M&S dual queues by - * virtue of only sometimes updating head or tail pointers when - * matching, appending, or even traversing nodes; in order to - * maintain a targeted slack. The idea of "sometimes" may be - * operationalized in several ways. The simplest is to use a - * per-operation counter incremented on each traversal step, and - * to try (via CAS) to update the associated queue pointer - * whenever the count exceeds a threshold. Another, that requires - * more overhead, is to use random number generators to update - * with a given probability per traversal step. - * - * In any strategy along these lines, because CASes updating - * fields may fail, the actual slack may exceed targeted - * slack. However, they may be retried at any time to maintain - * targets. Even when using very small slack values, this - * approach works well for dual queues because it allows all - * operations up to the point of matching or appending an item - * (hence potentially allowing progress by another thread) to be - * read-only, thus not introducing any further contention. As - * described below, we implement this by performing slack - * maintenance retries only after these points. - * - * As an accompaniment to such techniques, traversal overhead can - * be further reduced without increasing contention of head - * pointer updates: Threads may sometimes shortcut the "next" link - * path from the current "head" node to be closer to the currently - * known first unmatched node, and similarly for tail. Again, this - * may be triggered with using thresholds or randomization. - * - * These ideas must be further extended to avoid unbounded amounts - * of costly-to-reclaim garbage caused by the sequential "next" - * links of nodes starting at old forgotten head nodes: As first - * described in detail by Boehm - * (http://portal.acm.org/citation.cfm?doid=503272.503282) if a GC - * delays noticing that any arbitrarily old node has become - * garbage, all newer dead nodes will also be unreclaimed. - * (Similar issues arise in non-GC environments.) To cope with - * this in our implementation, upon CASing to advance the head - * pointer, we set the "next" link of the previous head to point - * only to itself; thus limiting the length of connected dead lists. - * (We also take similar care to wipe out possibly garbage - * retaining values held in other Node fields.) However, doing so - * adds some further complexity to traversal: If any "next" - * pointer links to itself, it indicates that the current thread - * has lagged behind a head-update, and so the traversal must - * continue from the "head". Traversals trying to find the - * current tail starting from "tail" may also encounter - * self-links, in which case they also continue at "head". - * - * It is tempting in slack-based scheme to not even use CAS for - * updates (similarly to Ladan-Mozes & Shavit). However, this - * cannot be done for head updates under the above link-forgetting - * mechanics because an update may leave head at a detached node. - * And while direct writes are possible for tail updates, they - * increase the risk of long retraversals, and hence long garbage - * chains, which can be much more costly than is worthwhile - * considering that the cost difference of performing a CAS vs - * write is smaller when they are not triggered on each operation - * (especially considering that writes and CASes equally require - * additional GC bookkeeping ("write barriers") that are sometimes - * more costly than the writes themselves because of contention). - * - * *** Overview of implementation *** - * - * We use a threshold-based approach to updates, with a slack - * threshold of two -- that is, we update head/tail when the - * current pointer appears to be two or more steps away from the - * first/last node. The slack value is hard-wired: a path greater - * than one is naturally implemented by checking equality of - * traversal pointers except when the list has only one element, - * in which case we keep slack threshold at one. Avoiding tracking - * explicit counts across method calls slightly simplifies an - * already-messy implementation. Using randomization would - * probably work better if there were a low-quality dirt-cheap - * per-thread one available, but even ThreadLocalRandom is too - * heavy for these purposes. - * - * With such a small slack threshold value, it is not worthwhile - * to augment this with path short-circuiting (i.e., unsplicing - * interior nodes) except in the case of cancellation/removal (see - * below). - * - * We allow both the head and tail fields to be null before any - * nodes are enqueued; initializing upon first append. This - * simplifies some other logic, as well as providing more - * efficient explicit control paths instead of letting JVMs insert - * implicit NullPointerExceptions when they are null. While not - * currently fully implemented, we also leave open the possibility - * of re-nulling these fields when empty (which is complicated to - * arrange, for little benefit.) - * - * All enqueue/dequeue operations are handled by the single method - * "xfer" with parameters indicating whether to act as some form - * of offer, put, poll, take, or transfer (each possibly with - * timeout). The relative complexity of using one monolithic - * method outweighs the code bulk and maintenance problems of - * using separate methods for each case. - * - * Operation consists of up to three phases. The first is - * implemented within method xfer, the second in tryAppend, and - * the third in method awaitMatch. - * - * 1. Try to match an existing node - * - * Starting at head, skip already-matched nodes until finding - * an unmatched node of opposite mode, if one exists, in which - * case matching it and returning, also if necessary updating - * head to one past the matched node (or the node itself if the - * list has no other unmatched nodes). If the CAS misses, then - * a loop retries advancing head by two steps until either - * success or the slack is at most two. By requiring that each - * attempt advances head by two (if applicable), we ensure that - * the slack does not grow without bound. Traversals also check - * if the initial head is now off-list, in which case they - * start at the new head. - * - * If no candidates are found and the call was untimed - * poll/offer, (argument "how" is NOW) return. - * - * 2. Try to append a new node (method tryAppend) - * - * Starting at current tail pointer, find the actual last node - * and try to append a new node (or if head was null, establish - * the first node). Nodes can be appended only if their - * predecessors are either already matched or are of the same - * mode. If we detect otherwise, then a new node with opposite - * mode must have been appended during traversal, so we must - * restart at phase 1. The traversal and update steps are - * otherwise similar to phase 1: Retrying upon CAS misses and - * checking for staleness. In particular, if a self-link is - * encountered, then we can safely jump to a node on the list - * by continuing the traversal at current head. - * - * On successful append, if the call was ASYNC, return. - * - * 3. Await match or cancellation (method awaitMatch) - * - * Wait for another thread to match node; instead cancelling if - * the current thread was interrupted or the wait timed out. On - * multiprocessors, we use front-of-queue spinning: If a node - * appears to be the first unmatched node in the queue, it - * spins a bit before blocking. In either case, before blocking - * it tries to unsplice any nodes between the current "head" - * and the first unmatched node. - * - * Front-of-queue spinning vastly improves performance of - * heavily contended queues. And so long as it is relatively - * brief and "quiet", spinning does not much impact performance - * of less-contended queues. During spins threads check their - * interrupt status and generate a thread-local random number - * to decide to occasionally perform a Thread.yield. While - * yield has underdefined specs, we assume that might it help, - * and will not hurt in limiting impact of spinning on busy - * systems. We also use smaller (1/2) spins for nodes that are - * not known to be front but whose predecessors have not - * blocked -- these "chained" spins avoid artifacts of - * front-of-queue rules which otherwise lead to alternating - * nodes spinning vs blocking. Further, front threads that - * represent phase changes (from data to request node or vice - * versa) compared to their predecessors receive additional - * chained spins, reflecting longer paths typically required to - * unblock threads during phase changes. - * - * - * ** Unlinking removed interior nodes ** - * - * In addition to minimizing garbage retention via self-linking - * described above, we also unlink removed interior nodes. These - * may arise due to timed out or interrupted waits, or calls to - * remove(x) or Iterator.remove. Normally, given a node that was - * at one time known to be the predecessor of some node s that is - * to be removed, we can unsplice s by CASing the next field of - * its predecessor if it still points to s (otherwise s must - * already have been removed or is now offlist). But there are two - * situations in which we cannot guarantee to make node s - * unreachable in this way: (1) If s is the trailing node of list - * (i.e., with null next), then it is pinned as the target node - * for appends, so can only be removed later when other nodes are - * appended. (2) We cannot necessarily unlink s given a - * predecessor node that is matched (including the case of being - * cancelled): the predecessor may already be unspliced, in which - * case some previous reachable node may still point to s. - * (For further explanation see Herlihy & Shavit "The Art of - * Multiprocessor Programming" chapter 9). Although, in both - * cases, we can rule out the need for further action if either s - * or its predecessor are (or can be made to be) at, or fall off - * from, the head of list. - * - * Without taking these into account, it would be possible for an - * unbounded number of supposedly removed nodes to remain - * reachable. Situations leading to such buildup are uncommon but - * can occur in practice; for example when a series of short timed - * calls to poll repeatedly time out but never otherwise fall off - * the list because of an untimed call to take at the front of the - * queue. - * - * When these cases arise, rather than always retraversing the - * entire list to find an actual predecessor to unlink (which - * won't help for case (1) anyway), we record a conservative - * estimate of possible unsplice failures (in "sweepVotes"). We - * trigger a full sweep when the estimate exceeds a threshold - * indicating the maximum number of estimated removal failures to - * tolerate before sweeping through, unlinking cancelled nodes - * that were not unlinked upon initial removal. We perform sweeps - * by the thread hitting threshold (rather than background threads - * or by spreading work to other threads) because in the main - * contexts in which removal occurs, the caller is already - * timed-out, cancelled, or performing a potentially O(n) - * operation (i.e., remove(x)), none of which are time-critical - * enough to warrant the overhead that alternatives would impose - * on other threads. - * - * Because the sweepVotes estimate is conservative, and because - * nodes become unlinked "naturally" as they fall off the head of - * the queue, and because we allow votes to accumulate even while - * sweeps are in progress, there are typically significantly fewer - * such nodes than estimated. Choice of a threshold value - * balances the likelihood of wasted effort and contention, versus - * providing a worst-case bound on retention of interior nodes in - * quiescent queues. The value defined below was chosen - * empirically to balance these under various timeout scenarios. - * - * Note that we cannot self-link unlinked interior nodes during - * sweeps. However, the associated garbage chains terminate when - * some successor ultimately falls off the head of the list and is - * self-linked. - */ - - /** - * True if on multiprocessor - */ - private static final boolean MP = - Runtime.getRuntime().availableProcessors() > 1; - - /** - * The number of times to spin (with randomly interspersed calls - * to Thread.yield) on multiprocessor before blocking when a node - * is apparently the first waiter in the queue. See above for - * explanation. Must be a power of two. The value is empirically - * derived -- it works pretty well across a variety of processors, - * numbers of CPUs, and OSes. - */ - private static final int FRONT_SPINS = 1 << 7; - - /** - * The number of times to spin before blocking when a node is - * preceded by another node that is apparently spinning. Also - * serves as an increment to FRONT_SPINS on phase changes, and as - * base average frequency for yielding during spins. Must be a - * power of two. - */ - private static final int CHAINED_SPINS = FRONT_SPINS >>> 1; - - /** - * The maximum number of estimated removal failures (sweepVotes) - * to tolerate before sweeping through the queue unlinking - * cancelled nodes that were not unlinked upon initial - * removal. See above for explanation. The value must be at least - * two to avoid useless sweeps when removing trailing nodes. - */ - static final int SWEEP_THRESHOLD = 32; - - /** - * Queue nodes. Uses Object, not E, for items to allow forgetting - * them after use. Relies heavily on Unsafe mechanics to minimize - * unnecessary ordering constraints: Writes that are intrinsically - * ordered wrt other accesses or CASes use simple relaxed forms. - */ - static final class Node { - final boolean isData; // false if this is a request node - volatile Object item; // initially non-null if isData; CASed to match - volatile Node next; - volatile Thread waiter; // null until waiting - - // CAS methods for fields - - final boolean casNext(Node cmp, Node val) { - return UNSAFE.compareAndSwapObject(this, nextOffset, cmp, val); - } - - final boolean casItem(Object cmp, Object val) { - assert cmp == null || cmp.getClass() != Node.class; - return UNSAFE.compareAndSwapObject(this, itemOffset, cmp, val); - } - - /** - * Creates a new node. Uses relaxed write because item can only - * be seen if followed by CAS. - */ - Node(Object item, boolean isData) { - UNSAFE.putObject(this, itemOffset, item); // relaxed write - this.isData = isData; - } - - /** - * Links node to itself to avoid garbage retention. Called - * only after CASing head field, so uses relaxed write. - */ - final void forgetNext() { - UNSAFE.putObject(this, nextOffset, this); - } - - /** - * Sets item to self and waiter to null, to avoid garbage - * retention after matching or cancelling. Uses relaxed writes - * bacause order is already constrained in the only calling - * contexts: item is forgotten only after volatile/atomic - * mechanics that extract items. Similarly, clearing waiter - * follows either CAS or return from park (if ever parked; - * else we don't care). - */ - final void forgetContents() { - UNSAFE.putObject(this, itemOffset, this); - UNSAFE.putObject(this, waiterOffset, null); - } - - /** - * Returns true if this node has been matched, including the - * case of artificial matches due to cancellation. - */ - final boolean isMatched() { - Object x = item; - return (x == this) || ((x == null) == isData); - } - - /** - * Returns true if this is an unmatched request node. - */ - final boolean isUnmatchedRequest() { - return !isData && item == null; - } - - /** - * Returns true if a node with the given mode cannot be - * appended to this node because this node is unmatched and - * has opposite data mode. - */ - final boolean cannotPrecede(boolean haveData) { - boolean d = isData; - Object x; - return d != haveData && (x = item) != this && (x != null) == d; - } - - /** - * Tries to artificially match a data node -- used by remove. - */ - final boolean tryMatchData() { - assert isData; - Object x = item; - if (x != null && x != this && casItem(x, null)) { - LockSupport.unpark(waiter); - return true; - } - return false; - } - - // Unsafe mechanics - private static final sun.misc.Unsafe UNSAFE = getUnsafe(); - private static final long nextOffset = - objectFieldOffset(UNSAFE, "next", Node.class); - private static final long itemOffset = - objectFieldOffset(UNSAFE, "item", Node.class); - private static final long waiterOffset = - objectFieldOffset(UNSAFE, "waiter", Node.class); - - private static final long serialVersionUID = -3375979862319811754L; - } - - /** - * head of the queue; null until first enqueue - */ - transient volatile Node head; - - /** - * tail of the queue; null until first append - */ - private transient volatile Node tail; - - /** - * The number of apparent failures to unsplice removed nodes - */ - private transient volatile int sweepVotes; - - // CAS methods for fields - - private boolean casTail(Node cmp, Node val) { - return UNSAFE.compareAndSwapObject(this, tailOffset, cmp, val); - } - - private boolean casHead(Node cmp, Node val) { - return UNSAFE.compareAndSwapObject(this, headOffset, cmp, val); - } - - private boolean casSweepVotes(int cmp, int val) { - return UNSAFE.compareAndSwapInt(this, sweepVotesOffset, cmp, val); - } - - /* - * Possible values for "how" argument in xfer method. - */ - private static final int NOW = 0; // for untimed poll, tryTransfer - private static final int ASYNC = 1; // for offer, put, add - private static final int SYNC = 2; // for transfer, take - private static final int TIMED = 3; // for timed poll, tryTransfer - - @SuppressWarnings("unchecked") - static E cast(Object item) { - assert item == null || item.getClass() != Node.class; - return (E) item; - } - - /** - * Implements all queuing methods. See above for explanation. - * - * @param e the item or null for take - * @param haveData true if this is a put, else a take - * @param how NOW, ASYNC, SYNC, or TIMED - * @param nanos timeout in nanosecs, used only if mode is TIMED - * @return an item if matched, else e - * @throws NullPointerException if haveData mode but e is null - */ - private E xfer(E e, boolean haveData, int how, long nanos) { - if (haveData && (e == null)) - throw new NullPointerException(); - Node s = null; // the node to append, if needed - - retry: - for (; ;) { // restart on append race - - for (Node h = head, p = h; p != null;) { // find & match first node - boolean isData = p.isData; - Object item = p.item; - if (item != p && (item != null) == isData) { // unmatched - if (isData == haveData) // can't match - break; - if (p.casItem(item, e)) { // match - for (Node q = p; q != h;) { - Node n = q.next; // update by 2 unless singleton - if (head == h && casHead(h, n == null ? q : n)) { - h.forgetNext(); - break; - } // advance and retry - if ((h = head) == null || - (q = h.next) == null || !q.isMatched()) - break; // unless slack < 2 - } - LockSupport.unpark(p.waiter); - return this.cast(item); - } - } - Node n = p.next; - p = (p != n) ? n : (h = head); // Use head if p offlist - } - - if (how != NOW) { // No matches available - if (s == null) - s = new Node(e, haveData); - Node pred = tryAppend(s, haveData); - if (pred == null) - continue retry; // lost race vs opposite mode - if (how != ASYNC) - return awaitMatch(s, pred, e, (how == TIMED), nanos); - } - return e; // not waiting - } - } - - /** - * Tries to append node s as tail. - * - * @param s the node to append - * @param haveData true if appending in data mode - * @return null on failure due to losing race with append in - * different mode, else s's predecessor, or s itself if no - * predecessor - */ - private Node tryAppend(Node s, boolean haveData) { - for (Node t = tail, p = t; ;) { // move p to last node and append - Node n, u; // temps for reads of next & tail - if (p == null && (p = head) == null) { - if (casHead(null, s)) - return s; // initialize - } else if (p.cannotPrecede(haveData)) - return null; // lost race vs opposite mode - else if ((n = p.next) != null) // not last; keep traversing - p = p != t && t != (u = tail) ? (t = u) : // stale tail - (p != n) ? n : null; // restart if off list - else if (!p.casNext(null, s)) - p = p.next; // re-read on CAS failure - else { - if (p != t) { // update if slack now >= 2 - while ((tail != t || !casTail(t, s)) && - (t = tail) != null && - (s = t.next) != null && // advance and retry - (s = s.next) != null && s != t) ; - } - return p; - } - } - } - - /** - * Spins/yields/blocks until node s is matched or caller gives up. - * - * @param s the waiting node - * @param pred the predecessor of s, or s itself if it has no - * predecessor, or null if unknown (the null case does not occur - * in any current calls but may in possible future extensions) - * @param e the comparison value for checking match - * @param timed if true, wait only until timeout elapses - * @param nanos timeout in nanosecs, used only if timed is true - * @return matched item, or e if unmatched on interrupt or timeout - */ - private E awaitMatch(Node s, Node pred, E e, boolean timed, long nanos) { - long lastTime = timed ? System.nanoTime() : 0L; - Thread w = Thread.currentThread(); - int spins = -1; // initialized after first item and cancel checks - ThreadLocalRandom randomYields = null; // bound if needed - - for (; ;) { - Object item = s.item; - if (item != e) { // matched - assert item != s; - s.forgetContents(); // avoid garbage - return this.cast(item); - } - if ((w.isInterrupted() || (timed && nanos <= 0)) && - s.casItem(e, s)) { // cancel - unsplice(pred, s); - return e; - } - - if (spins < 0) { // establish spins at/near front - if ((spins = spinsFor(pred, s.isData)) > 0) - randomYields = ThreadLocalRandom.current(); - } else if (spins > 0) { // spin - --spins; - if (randomYields.nextInt(CHAINED_SPINS) == 0) - Thread.yield(); // occasionally yield - } else if (s.waiter == null) { - s.waiter = w; // request unpark then recheck - } else if (timed) { - long now = System.nanoTime(); - if ((nanos -= now - lastTime) > 0) - LockSupport.parkNanos(this, nanos); - lastTime = now; - } else { - LockSupport.park(this); - } - } - } - - /** - * Returns spin/yield value for a node with given predecessor and - * data mode. See above for explanation. - */ - private static int spinsFor(Node pred, boolean haveData) { - if (MP && pred != null) { - if (pred.isData != haveData) // phase change - return FRONT_SPINS + CHAINED_SPINS; - if (pred.isMatched()) // probably at front - return FRONT_SPINS; - if (pred.waiter == null) // pred apparently spinning - return CHAINED_SPINS; - } - return 0; - } - - /* -------------- Traversal methods -------------- */ - - /** - * Returns the successor of p, or the head node if p.next has been - * linked to self, which will only be true if traversing with a - * stale pointer that is now off the list. - */ - final Node succ(Node p) { - Node next = p.next; - return (p == next) ? head : next; - } - - /** - * Returns the first unmatched node of the given mode, or null if - * none. Used by methods isEmpty, hasWaitingConsumer. - */ - private Node firstOfMode(boolean isData) { - for (Node p = head; p != null; p = succ(p)) { - if (!p.isMatched()) - return (p.isData == isData) ? p : null; - } - return null; - } - - /** - * Returns the item in the first unmatched node with isData; or - * null if none. Used by peek. - */ - private E firstDataItem() { - for (Node p = head; p != null; p = succ(p)) { - Object item = p.item; - if (p.isData) { - if (item != null && item != p) - return this.cast(item); - } else if (item == null) - return null; - } - return null; - } - - /** - * Traverses and counts unmatched nodes of the given mode. - * Used by methods size and getWaitingConsumerCount. - */ - private int countOfMode(boolean data) { - int count = 0; - for (Node p = head; p != null;) { - if (!p.isMatched()) { - if (p.isData != data) - return 0; - if (++count == Integer.MAX_VALUE) // saturated - break; - } - Node n = p.next; - if (n != p) - p = n; - else { - count = 0; - p = head; - } - } - return count; - } - - final class Itr implements Iterator { - private Node nextNode; // next node to return item for - private E nextItem; // the corresponding item - private Node lastRet; // last returned node, to support remove - private Node lastPred; // predecessor to unlink lastRet - - /** - * Moves to next node after prev, or first node if prev null. - */ - private void advance(Node prev) { - lastPred = lastRet; - lastRet = prev; - for (Node p = (prev == null) ? head : succ(prev); - p != null; p = succ(p)) { - Object item = p.item; - if (p.isData) { - if (item != null && item != p) { - nextItem = LinkedTransferQueue.this.cast(item); - nextNode = p; - return; - } - } else if (item == null) - break; - } - nextNode = null; - } - - Itr() { - advance(null); - } - - public final boolean hasNext() { - return nextNode != null; - } - - public final E next() { - Node p = nextNode; - if (p == null) throw new NoSuchElementException(); - E e = nextItem; - advance(p); - return e; - } - - public final void remove() { - Node p = lastRet; - if (p == null) throw new IllegalStateException(); - if (p.tryMatchData()) - unsplice(lastPred, p); - } - } - - /* -------------- Removal methods -------------- */ - - /** - * Unsplices (now or later) the given deleted/cancelled node with - * the given predecessor. - * - * @param pred a node that was at one time known to be the - * predecessor of s, or null or s itself if s is/was at head - * @param s the node to be unspliced - */ - final void unsplice(Node pred, Node s) { - s.forgetContents(); // forget unneeded fields - /* - * See above for rationale. Briefly: if pred still points to - * s, try to unlink s. If s cannot be unlinked, because it is - * trailing node or pred might be unlinked, and neither pred - * nor s are head or offlist, add to sweepVotes, and if enough - * votes have accumulated, sweep. - */ - if (pred != null && pred != s && pred.next == s) { - Node n = s.next; - if (n == null || - (n != s && pred.casNext(s, n) && pred.isMatched())) { - for (; ;) { // check if at, or could be, head - Node h = head; - if (h == pred || h == s || h == null) - return; // at head or list empty - if (!h.isMatched()) - break; - Node hn = h.next; - if (hn == null) - return; // now empty - if (hn != h && casHead(h, hn)) - h.forgetNext(); // advance head - } - if (pred.next != pred && s.next != s) { // recheck if offlist - for (; ;) { // sweep now if enough votes - int v = sweepVotes; - if (v < SWEEP_THRESHOLD) { - if (casSweepVotes(v, v + 1)) - break; - } else if (casSweepVotes(v, 0)) { - sweep(); - break; - } - } - } - } - } - } - - /** - * Unlinks matched nodes encountered in a traversal from head. - */ - private void sweep() { - for (Node p = head, s, n; p != null && (s = p.next) != null;) { - if (p == s) // stale - p = head; - else if (!s.isMatched()) - p = s; - else if ((n = s.next) == null) // trailing node is pinned - break; - else - p.casNext(s, n); - } - } - - /** - * Main implementation of remove(Object) - */ - private boolean findAndRemove(Object e) { - if (e != null) { - for (Node pred = null, p = head; p != null;) { - Object item = p.item; - if (p.isData) { - if (item != null && item != p && e.equals(item) && - p.tryMatchData()) { - unsplice(pred, p); - return true; - } - } else if (item == null) - break; - pred = p; - if ((p = p.next) == pred) { // stale - pred = null; - p = head; - } - } - } - return false; - } - - - /** - * Creates an initially empty {@code LinkedTransferQueue}. - */ - public LinkedTransferQueue() { - } - - /** - * Creates a {@code LinkedTransferQueue} - * initially containing the elements of the given collection, - * added in traversal order of the collection's iterator. - * - * @param c the collection of elements to initially contain - * @throws NullPointerException if the specified collection or any - * of its elements are null - */ - public LinkedTransferQueue(Collection c) { - this(); - addAll(c); - } - - /** - * Inserts the specified element at the tail of this queue. - * As the queue is unbounded, this method will never block. - * - * @throws NullPointerException if the specified element is null - */ - public void put(E e) { - xfer(e, true, ASYNC, 0); - } - - /** - * Inserts the specified element at the tail of this queue. - * As the queue is unbounded, this method will never block or - * return {@code false}. - * - * @return {@code true} (as specified by - * {@link BlockingQueue#offer(Object,long,TimeUnit) BlockingQueue.offer}) - * @throws NullPointerException if the specified element is null - */ - public boolean offer(E e, long timeout, TimeUnit unit) { - xfer(e, true, ASYNC, 0); - return true; - } - - /** - * Inserts the specified element at the tail of this queue. - * As the queue is unbounded, this method will never return {@code false}. - * - * @return {@code true} (as specified by - * {@link BlockingQueue#offer(Object) BlockingQueue.offer}) - * @throws NullPointerException if the specified element is null - */ - public boolean offer(E e) { - xfer(e, true, ASYNC, 0); - return true; - } - - /** - * Inserts the specified element at the tail of this queue. - * As the queue is unbounded, this method will never throw - * {@link IllegalStateException} or return {@code false}. - * - * @return {@code true} (as specified by {@link Collection#add}) - * @throws NullPointerException if the specified element is null - */ - public boolean add(E e) { - xfer(e, true, ASYNC, 0); - return true; - } - - /** - * Transfers the element to a waiting consumer immediately, if possible. - * - *

More precisely, transfers the specified element immediately - * if there exists a consumer already waiting to receive it (in - * {@link #take} or timed {@link #poll(long,TimeUnit) poll}), - * otherwise returning {@code false} without enqueuing the element. - * - * @throws NullPointerException if the specified element is null - */ - public boolean tryTransfer(E e) { - return xfer(e, true, NOW, 0) == null; - } - - /** - * Transfers the element to a consumer, waiting if necessary to do so. - * - *

More precisely, transfers the specified element immediately - * if there exists a consumer already waiting to receive it (in - * {@link #take} or timed {@link #poll(long,TimeUnit) poll}), - * else inserts the specified element at the tail of this queue - * and waits until the element is received by a consumer. - * - * @throws NullPointerException if the specified element is null - */ - public void transfer(E e) throws InterruptedException { - if (xfer(e, true, SYNC, 0) != null) { - Thread.interrupted(); // failure possible only due to interrupt - throw new InterruptedException(); - } - } - - /** - * Transfers the element to a consumer if it is possible to do so - * before the timeout elapses. - * - *

More precisely, transfers the specified element immediately - * if there exists a consumer already waiting to receive it (in - * {@link #take} or timed {@link #poll(long,TimeUnit) poll}), - * else inserts the specified element at the tail of this queue - * and waits until the element is received by a consumer, - * returning {@code false} if the specified wait time elapses - * before the element can be transferred. - * - * @throws NullPointerException if the specified element is null - */ - public boolean tryTransfer(E e, long timeout, TimeUnit unit) - throws InterruptedException { - if (xfer(e, true, TIMED, unit.toNanos(timeout)) == null) - return true; - if (!Thread.interrupted()) - return false; - throw new InterruptedException(); - } - - public E take() throws InterruptedException { - E e = xfer(null, false, SYNC, 0); - if (e != null) - return e; - Thread.interrupted(); - throw new InterruptedException(); - } - - public E poll(long timeout, TimeUnit unit) throws InterruptedException { - E e = xfer(null, false, TIMED, unit.toNanos(timeout)); - if (e != null || !Thread.interrupted()) - return e; - throw new InterruptedException(); - } - - public E poll() { - return xfer(null, false, NOW, 0); - } - - /** - * @throws NullPointerException {@inheritDoc} - * @throws IllegalArgumentException {@inheritDoc} - */ - public int drainTo(Collection c) { - if (c == null) - throw new NullPointerException(); - if (c == this) - throw new IllegalArgumentException(); - int n = 0; - E e; - while ((e = poll()) != null) { - c.add(e); - ++n; - } - return n; - } - - /** - * @throws NullPointerException {@inheritDoc} - * @throws IllegalArgumentException {@inheritDoc} - */ - public int drainTo(Collection c, int maxElements) { - if (c == null) - throw new NullPointerException(); - if (c == this) - throw new IllegalArgumentException(); - int n = 0; - E e; - while (n < maxElements && (e = poll()) != null) { - c.add(e); - ++n; - } - return n; - } - - /** - * Returns an iterator over the elements in this queue in proper - * sequence, from head to tail. - * - *

The returned iterator is a "weakly consistent" iterator that - * will never throw - * {@link ConcurrentModificationException ConcurrentModificationException}, - * and guarantees to traverse elements as they existed upon - * construction of the iterator, and may (but is not guaranteed - * to) reflect any modifications subsequent to construction. - * - * @return an iterator over the elements in this queue in proper sequence - */ - public Iterator iterator() { - return new Itr(); - } - - public E peek() { - return firstDataItem(); - } - - /** - * Returns {@code true} if this queue contains no elements. - * - * @return {@code true} if this queue contains no elements - */ - public boolean isEmpty() { - for (Node p = head; p != null; p = succ(p)) { - if (!p.isMatched()) - return !p.isData; - } - return true; - } - - public boolean hasWaitingConsumer() { - return firstOfMode(false) != null; - } - - /** - * Returns the number of elements in this queue. If this queue - * contains more than {@code Integer.MAX_VALUE} elements, returns - * {@code Integer.MAX_VALUE}. - * - *

Beware that, unlike in most collections, this method is - * NOT a constant-time operation. Because of the - * asynchronous nature of these queues, determining the current - * number of elements requires an O(n) traversal. - * - * @return the number of elements in this queue - */ - public int size() { - return countOfMode(true); - } - - public int getWaitingConsumerCount() { - return countOfMode(false); - } - - /** - * Removes a single instance of the specified element from this queue, - * if it is present. More formally, removes an element {@code e} such - * that {@code o.equals(e)}, if this queue contains one or more such - * elements. - * Returns {@code true} if this queue contained the specified element - * (or equivalently, if this queue changed as a result of the call). - * - * @param o element to be removed from this queue, if present - * @return {@code true} if this queue changed as a result of the call - */ - public boolean remove(Object o) { - return findAndRemove(o); - } - - /** - * Always returns {@code Integer.MAX_VALUE} because a - * {@code LinkedTransferQueue} is not capacity constrained. - * - * @return {@code Integer.MAX_VALUE} (as specified by - * {@link BlockingQueue#remainingCapacity()}) - */ - public int remainingCapacity() { - return Integer.MAX_VALUE; - } - - /** - * Saves the state to a stream (that is, serializes it). - * - * @param s the stream - * @serialData All of the elements (each an {@code E}) in - * the proper order, followed by a null - */ - private void writeObject(java.io.ObjectOutputStream s) - throws java.io.IOException { - s.defaultWriteObject(); - for (E e : this) - s.writeObject(e); - // Use trailing null as sentinel - s.writeObject(null); - } - - /** - * Reconstitutes the Queue instance from a stream (that is, - * deserializes it). - * - * @param s the stream - */ - private void readObject(java.io.ObjectInputStream s) - throws java.io.IOException, ClassNotFoundException { - s.defaultReadObject(); - for (; ;) { - @SuppressWarnings("unchecked") E item = (E) s.readObject(); - if (item == null) - break; - else - offer(item); - } - } - - // Unsafe mechanics - - private static final sun.misc.Unsafe UNSAFE = getUnsafe(); - private static final long headOffset = - objectFieldOffset(UNSAFE, "head", LinkedTransferQueue.class); - private static final long tailOffset = - objectFieldOffset(UNSAFE, "tail", LinkedTransferQueue.class); - private static final long sweepVotesOffset = - objectFieldOffset(UNSAFE, "sweepVotes", LinkedTransferQueue.class); - - static long objectFieldOffset(sun.misc.Unsafe UNSAFE, - String field, Class klazz) { - try { - return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field)); - } catch (NoSuchFieldException e) { - // Convert Exception to corresponding Error - NoSuchFieldError error = new NoSuchFieldError(field); - error.initCause(e); - throw error; - } - } - - /** - * Returns a sun.misc.Unsafe. Suitable for use in a 3rd party package. - * Replace with a simple call to Unsafe.getUnsafe when integrating - * into a jdk. - * - * @return a sun.misc.Unsafe - */ - static sun.misc.Unsafe getUnsafe() { - try { - return sun.misc.Unsafe.getUnsafe(); - } catch (SecurityException se) { - try { - return java.security.AccessController.doPrivileged - (new java.security - .PrivilegedExceptionAction() { - public sun.misc.Unsafe run() throws Exception { - java.lang.reflect.Field f = sun.misc - .Unsafe.class.getDeclaredField("theUnsafe"); - f.setAccessible(true); - return (sun.misc.Unsafe) f.get(null); - } - }); - } catch (java.security.PrivilegedActionException e) { - throw new RuntimeException("Could not initialize intrinsics", - e.getCause()); - } - } - } - -} diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/Phaser.java b/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/Phaser.java deleted file mode 100644 index f6eb49d8371..00000000000 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/Phaser.java +++ /dev/null @@ -1,1065 +0,0 @@ -/* - * Licensed to Elastic Search and Shay Banon under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. Elastic Search 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. - */ - -/* - * Written by Doug Lea with assistance from members of JCP JSR-166 - * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain - */ - -package org.elasticsearch.util.concurrent.jsr166y; - -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; -import java.util.concurrent.atomic.AtomicReference; -import java.util.concurrent.locks.LockSupport; - -/** - * A reusable synchronization barrier, similar in functionality to - * {@link java.util.concurrent.CyclicBarrier CyclicBarrier} and - * {@link java.util.concurrent.CountDownLatch CountDownLatch} - * but supporting more flexible usage. - * - *

Registration. Unlike the case for other barriers, the - * number of parties registered to synchronize on a phaser - * may vary over time. Tasks may be registered at any time (using - * methods {@link #register}, {@link #bulkRegister}, or forms of - * constructors establishing initial numbers of parties), and - * optionally deregistered upon any arrival (using {@link - * #arriveAndDeregister}). As is the case with most basic - * synchronization constructs, registration and deregistration affect - * only internal counts; they do not establish any further internal - * bookkeeping, so tasks cannot query whether they are registered. - * (However, you can introduce such bookkeeping by subclassing this - * class.) - * - *

Synchronization. Like a {@code CyclicBarrier}, a {@code - * Phaser} may be repeatedly awaited. Method {@link - * #arriveAndAwaitAdvance} has effect analogous to {@link - * java.util.concurrent.CyclicBarrier#await CyclicBarrier.await}. Each - * generation of a {@code Phaser} has an associated phase number. The - * phase number starts at zero, and advances when all parties arrive - * at the barrier, wrapping around to zero after reaching {@code - * Integer.MAX_VALUE}. The use of phase numbers enables independent - * control of actions upon arrival at a barrier and upon awaiting - * others, via two kinds of methods that may be invoked by any - * registered party: - * - *

    - * - *
  • Arrival. Methods {@link #arrive} and - * {@link #arriveAndDeregister} record arrival at a - * barrier. These methods do not block, but return an associated - * arrival phase number; that is, the phase number of - * the barrier to which the arrival applied. When the final - * party for a given phase arrives, an optional barrier action - * is performed and the phase advances. Barrier actions, - * performed by the party triggering a phase advance, are - * arranged by overriding method {@link #onAdvance(int, int)}, - * which also controls termination. Overriding this method is - * similar to, but more flexible than, providing a barrier - * action to a {@code CyclicBarrier}. - * - *
  • Waiting. Method {@link #awaitAdvance} requires an - * argument indicating an arrival phase number, and returns when - * the barrier advances to (or is already at) a different phase. - * Unlike similar constructions using {@code CyclicBarrier}, - * method {@code awaitAdvance} continues to wait even if the - * waiting thread is interrupted. Interruptible and timeout - * versions are also available, but exceptions encountered while - * tasks wait interruptibly or with timeout do not change the - * state of the barrier. If necessary, you can perform any - * associated recovery within handlers of those exceptions, - * often after invoking {@code forceTermination}. Phasers may - * also be used by tasks executing in a {@link ForkJoinPool}, - * which will ensure sufficient parallelism to execute tasks - * when others are blocked waiting for a phase to advance. - * - *
- * - *

Termination. A {@code Phaser} may enter a - * termination state in which all synchronization methods - * immediately return without updating phaser state or waiting for - * advance, and indicating (via a negative phase value) that execution - * is complete. Termination is triggered when an invocation of {@code - * onAdvance} returns {@code true}. As illustrated below, when - * phasers control actions with a fixed number of iterations, it is - * often convenient to override this method to cause termination when - * the current phase number reaches a threshold. Method {@link - * #forceTermination} is also available to abruptly release waiting - * threads and allow them to terminate. - * - *

Tiering. Phasers may be tiered (i.e., arranged - * in tree structures) to reduce contention. Phasers with large - * numbers of parties that would otherwise experience heavy - * synchronization contention costs may instead be set up so that - * groups of sub-phasers share a common parent. This may greatly - * increase throughput even though it incurs greater per-operation - * overhead. - * - *

Monitoring. While synchronization methods may be invoked - * only by registered parties, the current state of a phaser may be - * monitored by any caller. At any given moment there are {@link - * #getRegisteredParties} parties in total, of which {@link - * #getArrivedParties} have arrived at the current phase ({@link - * #getPhase}). When the remaining ({@link #getUnarrivedParties}) - * parties arrive, the phase advances. The values returned by these - * methods may reflect transient states and so are not in general - * useful for synchronization control. Method {@link #toString} - * returns snapshots of these state queries in a form convenient for - * informal monitoring. - * - *

Sample usages: - * - *

A {@code Phaser} may be used instead of a {@code CountDownLatch} - * to control a one-shot action serving a variable number of - * parties. The typical idiom is for the method setting this up to - * first register, then start the actions, then deregister, as in: - * - *

 {@code
- * void runTasks(List tasks) {
- *   final Phaser phaser = new Phaser(1); // "1" to register self
- *   // create and start threads
- *   for (Runnable task : tasks) {
- *     phaser.register();
- *     new Thread() {
- *       public void run() {
- *         phaser.arriveAndAwaitAdvance(); // await all creation
- *         task.run();
- *       }
- *     }.start();
- *   }
- *
- *   // allow threads to start and deregister self
- *   phaser.arriveAndDeregister();
- * }}
- * - *

One way to cause a set of threads to repeatedly perform actions - * for a given number of iterations is to override {@code onAdvance}: - * - *

 {@code
- * void startTasks(List tasks, final int iterations) {
- *   final Phaser phaser = new Phaser() {
- *     protected boolean onAdvance(int phase, int registeredParties) {
- *       return phase >= iterations || registeredParties == 0;
- *     }
- *   };
- *   phaser.register();
- *   for (final Runnable task : tasks) {
- *     phaser.register();
- *     new Thread() {
- *       public void run() {
- *         do {
- *           task.run();
- *           phaser.arriveAndAwaitAdvance();
- *         } while (!phaser.isTerminated());
- *       }
- *     }.start();
- *   }
- *   phaser.arriveAndDeregister(); // deregister self, don't wait
- * }}
- * - * If the main task must later await termination, it - * may re-register and then execute a similar loop: - *
 {@code
- *   // ...
- *   phaser.register();
- *   while (!phaser.isTerminated())
- *     phaser.arriveAndAwaitAdvance();}
- * - *

Related constructions may be used to await particular phase numbers - * in contexts where you are sure that the phase will never wrap around - * {@code Integer.MAX_VALUE}. For example: - * - *

 {@code
- * void awaitPhase(Phaser phaser, int phase) {
- *   int p = phaser.register(); // assumes caller not already registered
- *   while (p < phase) {
- *     if (phaser.isTerminated())
- *       // ... deal with unexpected termination
- *     else
- *       p = phaser.arriveAndAwaitAdvance();
- *   }
- *   phaser.arriveAndDeregister();
- * }}
- * - * - *

To create a set of tasks using a tree of phasers, - * you could use code of the following form, assuming a - * Task class with a constructor accepting a phaser that - * it registers for upon construction: - * - *

 {@code
- * void build(Task[] actions, int lo, int hi, Phaser ph) {
- *   if (hi - lo > TASKS_PER_PHASER) {
- *     for (int i = lo; i < hi; i += TASKS_PER_PHASER) {
- *       int j = Math.min(i + TASKS_PER_PHASER, hi);
- *       build(actions, i, j, new Phaser(ph));
- *     }
- *   } else {
- *     for (int i = lo; i < hi; ++i)
- *       actions[i] = new Task(ph);
- *       // assumes new Task(ph) performs ph.register()
- *   }
- * }
- * // .. initially called, for n tasks via
- * build(new Task[n], 0, n, new Phaser());}
- * - * The best value of {@code TASKS_PER_PHASER} depends mainly on - * expected barrier synchronization rates. A value as low as four may - * be appropriate for extremely small per-barrier task bodies (thus - * high rates), or up to hundreds for extremely large ones. - * - *
- * - *

Implementation notes: This implementation restricts the - * maximum number of parties to 65535. Attempts to register additional - * parties result in {@code IllegalStateException}. However, you can and - * should create tiered phasers to accommodate arbitrarily large sets - * of participants. - * - * @author Doug Lea - * @since 1.7 - */ -public class Phaser { - /* - * This class implements an extension of X10 "clocks". Thanks to - * Vijay Saraswat for the idea, and to Vivek Sarkar for - * enhancements to extend functionality. - */ - - /** - * Barrier state representation. Conceptually, a barrier contains - * four values: - * - * * parties -- the number of parties to wait (16 bits) - * * unarrived -- the number of parties yet to hit barrier (16 bits) - * * phase -- the generation of the barrier (31 bits) - * * terminated -- set if barrier is terminated (1 bit) - * - * However, to efficiently maintain atomicity, these values are - * packed into a single (atomic) long. Termination uses the sign - * bit of 32 bit representation of phase, so phase is set to -1 on - * termination. Good performance relies on keeping state decoding - * and encoding simple, and keeping race windows short. - * - * Note: there are some cheats in arrive() that rely on unarrived - * count being lowest 16 bits. - */ - private volatile long state; - - private static final int ushortMask = 0xffff; - private static final int phaseMask = 0x7fffffff; - - private static int unarrivedOf(long s) { - return (int) (s & ushortMask); - } - - private static int partiesOf(long s) { - return ((int) s) >>> 16; - } - - private static int phaseOf(long s) { - return (int) (s >>> 32); - } - - private static int arrivedOf(long s) { - return partiesOf(s) - unarrivedOf(s); - } - - private static long stateFor(int phase, int parties, int unarrived) { - return ((((long) phase) << 32) | (((long) parties) << 16) | - (long) unarrived); - } - - private static long trippedStateFor(int phase, int parties) { - long lp = (long) parties; - return (((long) phase) << 32) | (lp << 16) | lp; - } - - /** - * Returns message string for bad bounds exceptions. - */ - private static String badBounds(int parties, int unarrived) { - return ("Attempt to set " + unarrived + - " unarrived of " + parties + " parties"); - } - - /** - * The parent of this phaser, or null if none - */ - private final Phaser parent; - - /** - * The root of phaser tree. Equals this if not in a tree. Used to - * support faster state push-down. - */ - private final Phaser root; - - // Wait queues - - /** - * Heads of Treiber stacks for waiting threads. To eliminate - * contention while releasing some threads while adding others, we - * use two of them, alternating across even and odd phases. - */ - private final AtomicReference evenQ = new AtomicReference(); - private final AtomicReference oddQ = new AtomicReference(); - - private AtomicReference queueFor(int phase) { - return ((phase & 1) == 0) ? evenQ : oddQ; - } - - /** - * Returns current state, first resolving lagged propagation from - * root if necessary. - */ - private long getReconciledState() { - return (parent == null) ? state : reconcileState(); - } - - /** - * Recursively resolves state. - */ - private long reconcileState() { - Phaser p = parent; - long s = state; - if (p != null) { - while (unarrivedOf(s) == 0 && phaseOf(s) != phaseOf(root.state)) { - long parentState = p.getReconciledState(); - int parentPhase = phaseOf(parentState); - int phase = phaseOf(s = state); - if (phase != parentPhase) { - long next = trippedStateFor(parentPhase, partiesOf(s)); - if (casState(s, next)) { - releaseWaiters(phase); - s = next; - } - } - } - } - return s; - } - - /** - * Creates a new phaser without any initially registered parties, - * initial phase number 0, and no parent. Any thread using this - * phaser will need to first register for it. - */ - public Phaser() { - this(null); - } - - /** - * Creates a new phaser with the given numbers of registered - * unarrived parties, initial phase number 0, and no parent. - * - * @param parties the number of parties required to trip barrier - * @throws IllegalArgumentException if parties less than zero - * or greater than the maximum number of parties supported - */ - public Phaser(int parties) { - this(null, parties); - } - - /** - * Creates a new phaser with the given parent, without any - * initially registered parties. If parent is non-null this phaser - * is registered with the parent and its initial phase number is - * the same as that of parent phaser. - * - * @param parent the parent phaser - */ - public Phaser(Phaser parent) { - int phase = 0; - this.parent = parent; - if (parent != null) { - this.root = parent.root; - phase = parent.register(); - } else - this.root = this; - this.state = trippedStateFor(phase, 0); - } - - /** - * Creates a new phaser with the given parent and numbers of - * registered unarrived parties. If parent is non-null, this phaser - * is registered with the parent and its initial phase number is - * the same as that of parent phaser. - * - * @param parent the parent phaser - * @param parties the number of parties required to trip barrier - * @throws IllegalArgumentException if parties less than zero - * or greater than the maximum number of parties supported - */ - public Phaser(Phaser parent, int parties) { - if (parties < 0 || parties > ushortMask) - throw new IllegalArgumentException("Illegal number of parties"); - int phase = 0; - this.parent = parent; - if (parent != null) { - this.root = parent.root; - phase = parent.register(); - } else - this.root = this; - this.state = trippedStateFor(phase, parties); - } - - /** - * Adds a new unarrived party to this phaser. - * - * @return the arrival phase number to which this registration applied - * @throws IllegalStateException if attempting to register more - * than the maximum supported number of parties - */ - public int register() { - return doRegister(1); - } - - /** - * Adds the given number of new unarrived parties to this phaser. - * - * @param parties the number of parties required to trip barrier - * @return the arrival phase number to which this registration applied - * @throws IllegalStateException if attempting to register more - * than the maximum supported number of parties - */ - public int bulkRegister(int parties) { - if (parties < 0) - throw new IllegalArgumentException(); - if (parties == 0) - return getPhase(); - return doRegister(parties); - } - - /** - * Shared code for register, bulkRegister - */ - private int doRegister(int registrations) { - int phase; - for (; ;) { - long s = getReconciledState(); - phase = phaseOf(s); - int unarrived = unarrivedOf(s) + registrations; - int parties = partiesOf(s) + registrations; - if (phase < 0) - break; - if (parties > ushortMask || unarrived > ushortMask) - throw new IllegalStateException(badBounds(parties, unarrived)); - if (phase == phaseOf(root.state) && - casState(s, stateFor(phase, parties, unarrived))) - break; - } - return phase; - } - - /** - * Arrives at the barrier, but does not wait for others. (You can - * in turn wait for others via {@link #awaitAdvance}). It is an - * unenforced usage error for an unregistered party to invoke this - * method. - * - * @return the arrival phase number, or a negative value if terminated - * @throws IllegalStateException if not terminated and the number - * of unarrived parties would become negative - */ - public int arrive() { - int phase; - for (; ;) { - long s = state; - phase = phaseOf(s); - if (phase < 0) - break; - int parties = partiesOf(s); - int unarrived = unarrivedOf(s) - 1; - if (unarrived > 0) { // Not the last arrival - if (casState(s, s - 1)) // s-1 adds one arrival - break; - } else if (unarrived == 0) { // the last arrival - Phaser par = parent; - if (par == null) { // directly trip - if (casState - (s, - trippedStateFor(onAdvance(phase, parties) ? -1 : - ((phase + 1) & phaseMask), parties))) { - releaseWaiters(phase); - break; - } - } else { // cascade to parent - if (casState(s, s - 1)) { // zeroes unarrived - par.arrive(); - reconcileState(); - break; - } - } - } else if (phase != phaseOf(root.state)) // or if unreconciled - reconcileState(); - else - throw new IllegalStateException(badBounds(parties, unarrived)); - } - return phase; - } - - /** - * Arrives at the barrier and deregisters from it without waiting - * for others. Deregistration reduces the number of parties - * required to trip the barrier in future phases. If this phaser - * has a parent, and deregistration causes this phaser to have - * zero parties, this phaser also arrives at and is deregistered - * from its parent. It is an unenforced usage error for an - * unregistered party to invoke this method. - * - * @return the arrival phase number, or a negative value if terminated - * @throws IllegalStateException if not terminated and the number - * of registered or unarrived parties would become negative - */ - public int arriveAndDeregister() { - // similar code to arrive, but too different to merge - Phaser par = parent; - int phase; - for (; ;) { - long s = state; - phase = phaseOf(s); - if (phase < 0) - break; - int parties = partiesOf(s) - 1; - int unarrived = unarrivedOf(s) - 1; - if (parties >= 0) { - if (unarrived > 0 || (unarrived == 0 && par != null)) { - if (casState - (s, - stateFor(phase, parties, unarrived))) { - if (unarrived == 0) { - par.arriveAndDeregister(); - reconcileState(); - } - break; - } - continue; - } - if (unarrived == 0) { - if (casState - (s, - trippedStateFor(onAdvance(phase, parties) ? -1 : - ((phase + 1) & phaseMask), parties))) { - releaseWaiters(phase); - break; - } - continue; - } - if (par != null && phase != phaseOf(root.state)) { - reconcileState(); - continue; - } - } - throw new IllegalStateException(badBounds(parties, unarrived)); - } - return phase; - } - - /** - * Arrives at the barrier and awaits others. Equivalent in effect - * to {@code awaitAdvance(arrive())}. If you need to await with - * interruption or timeout, you can arrange this with an analogous - * construction using one of the other forms of the awaitAdvance - * method. If instead you need to deregister upon arrival use - * {@code arriveAndDeregister}. It is an unenforced usage error - * for an unregistered party to invoke this method. - * - * @return the arrival phase number, or a negative number if terminated - * @throws IllegalStateException if not terminated and the number - * of unarrived parties would become negative - */ - public int arriveAndAwaitAdvance() { - return awaitAdvance(arrive()); - } - - /** - * Awaits the phase of the barrier to advance from the given phase - * value, returning immediately if the current phase of the - * barrier is not equal to the given phase value or this barrier - * is terminated. It is an unenforced usage error for an - * unregistered party to invoke this method. - * - * @param phase an arrival phase number, or negative value if - * terminated; this argument is normally the value returned by a - * previous call to {@code arrive} or its variants - * @return the next arrival phase number, or a negative value - * if terminated or argument is negative - */ - public int awaitAdvance(int phase) { - if (phase < 0) - return phase; - long s = getReconciledState(); - int p = phaseOf(s); - if (p != phase) - return p; - if (unarrivedOf(s) == 0 && parent != null) - parent.awaitAdvance(phase); - // Fall here even if parent waited, to reconcile and help release - return untimedWait(phase); - } - - /** - * Awaits the phase of the barrier to advance from the given phase - * value, throwing {@code InterruptedException} if interrupted - * while waiting, or returning immediately if the current phase of - * the barrier is not equal to the given phase value or this - * barrier is terminated. It is an unenforced usage error for an - * unregistered party to invoke this method. - * - * @param phase an arrival phase number, or negative value if - * terminated; this argument is normally the value returned by a - * previous call to {@code arrive} or its variants - * @return the next arrival phase number, or a negative value - * if terminated or argument is negative - * @throws InterruptedException if thread interrupted while waiting - */ - public int awaitAdvanceInterruptibly(int phase) - throws InterruptedException { - if (phase < 0) - return phase; - long s = getReconciledState(); - int p = phaseOf(s); - if (p != phase) - return p; - if (unarrivedOf(s) == 0 && parent != null) - parent.awaitAdvanceInterruptibly(phase); - return interruptibleWait(phase); - } - - /** - * Awaits the phase of the barrier to advance from the given phase - * value or the given timeout to elapse, throwing {@code - * InterruptedException} if interrupted while waiting, or - * returning immediately if the current phase of the barrier is - * not equal to the given phase value or this barrier is - * terminated. It is an unenforced usage error for an - * unregistered party to invoke this method. - * - * @param phase an arrival phase number, or negative value if - * terminated; this argument is normally the value returned by a - * previous call to {@code arrive} or its variants - * @param timeout how long to wait before giving up, in units of - * {@code unit} - * @param unit a {@code TimeUnit} determining how to interpret the - * {@code timeout} parameter - * @return the next arrival phase number, or a negative value - * if terminated or argument is negative - * @throws InterruptedException if thread interrupted while waiting - * @throws TimeoutException if timed out while waiting - */ - public int awaitAdvanceInterruptibly(int phase, - long timeout, TimeUnit unit) - throws InterruptedException, TimeoutException { - if (phase < 0) - return phase; - long s = getReconciledState(); - int p = phaseOf(s); - if (p != phase) - return p; - if (unarrivedOf(s) == 0 && parent != null) - parent.awaitAdvanceInterruptibly(phase, timeout, unit); - return timedWait(phase, unit.toNanos(timeout)); - } - - /** - * Forces this barrier to enter termination state. Counts of - * arrived and registered parties are unaffected. If this phaser - * has a parent, it too is terminated. This method may be useful - * for coordinating recovery after one or more tasks encounter - * unexpected exceptions. - */ - public void forceTermination() { - for (; ;) { - long s = getReconciledState(); - int phase = phaseOf(s); - int parties = partiesOf(s); - int unarrived = unarrivedOf(s); - if (phase < 0 || - casState(s, stateFor(-1, parties, unarrived))) { - releaseWaiters(0); - releaseWaiters(1); - if (parent != null) - parent.forceTermination(); - return; - } - } - } - - /** - * Returns the current phase number. The maximum phase number is - * {@code Integer.MAX_VALUE}, after which it restarts at - * zero. Upon termination, the phase number is negative. - * - * @return the phase number, or a negative value if terminated - */ - public final int getPhase() { - return phaseOf(getReconciledState()); - } - - /** - * Returns the number of parties registered at this barrier. - * - * @return the number of parties - */ - public int getRegisteredParties() { - return partiesOf(state); - } - - /** - * Returns the number of registered parties that have arrived at - * the current phase of this barrier. - * - * @return the number of arrived parties - */ - public int getArrivedParties() { - return arrivedOf(state); - } - - /** - * Returns the number of registered parties that have not yet - * arrived at the current phase of this barrier. - * - * @return the number of unarrived parties - */ - public int getUnarrivedParties() { - return unarrivedOf(state); - } - - /** - * Returns the parent of this phaser, or {@code null} if none. - * - * @return the parent of this phaser, or {@code null} if none - */ - public Phaser getParent() { - return parent; - } - - /** - * Returns the root ancestor of this phaser, which is the same as - * this phaser if it has no parent. - * - * @return the root ancestor of this phaser - */ - public Phaser getRoot() { - return root; - } - - /** - * Returns {@code true} if this barrier has been terminated. - * - * @return {@code true} if this barrier has been terminated - */ - public boolean isTerminated() { - return getPhase() < 0; - } - - /** - * Overridable method to perform an action upon impending phase - * advance, and to control termination. This method is invoked - * upon arrival of the party tripping the barrier (when all other - * waiting parties are dormant). If this method returns {@code - * true}, then, rather than advance the phase number, this barrier - * will be set to a final termination state, and subsequent calls - * to {@link #isTerminated} will return true. Any (unchecked) - * Exception or Error thrown by an invocation of this method is - * propagated to the party attempting to trip the barrier, in - * which case no advance occurs. - * - *

The arguments to this method provide the state of the phaser - * prevailing for the current transition. (When called from within - * an implementation of {@code onAdvance} the values returned by - * methods such as {@code getPhase} may or may not reliably - * indicate the state to which this transition applies.) - * - *

The default version returns {@code true} when the number of - * registered parties is zero. Normally, overrides that arrange - * termination for other reasons should also preserve this - * property. - * - *

You may override this method to perform an action with side - * effects visible to participating tasks, but it is only sensible - * to do so in designs where all parties register before any - * arrive, and all {@link #awaitAdvance} at each phase. - * Otherwise, you cannot ensure lack of interference from other - * parties during the invocation of this method. Additionally, - * method {@code onAdvance} may be invoked more than once per - * transition if registrations are intermixed with arrivals. - * - * @param phase the phase number on entering the barrier - * @param registeredParties the current number of registered parties - * @return {@code true} if this barrier should terminate - */ - protected boolean onAdvance(int phase, int registeredParties) { - return registeredParties <= 0; - } - - /** - * Returns a string identifying this phaser, as well as its - * state. The state, in brackets, includes the String {@code - * "phase = "} followed by the phase number, {@code "parties = "} - * followed by the number of registered parties, and {@code - * "arrived = "} followed by the number of arrived parties. - * - * @return a string identifying this barrier, as well as its state - */ - public String toString() { - long s = getReconciledState(); - return super.toString() + - "[phase = " + phaseOf(s) + - " parties = " + partiesOf(s) + - " arrived = " + arrivedOf(s) + "]"; - } - - // methods for waiting - - /** - * Wait nodes for Treiber stack representing wait queue - */ - static final class QNode implements ForkJoinPool.ManagedBlocker { - final Phaser phaser; - final int phase; - final long startTime; - final long nanos; - final boolean timed; - final boolean interruptible; - volatile boolean wasInterrupted = false; - volatile Thread thread; // nulled to cancel wait - QNode next; - - QNode(Phaser phaser, int phase, boolean interruptible, - boolean timed, long startTime, long nanos) { - this.phaser = phaser; - this.phase = phase; - this.timed = timed; - this.interruptible = interruptible; - this.startTime = startTime; - this.nanos = nanos; - thread = Thread.currentThread(); - } - - public boolean isReleasable() { - return (thread == null || - phaser.getPhase() != phase || - (interruptible && wasInterrupted) || - (timed && (nanos - (System.nanoTime() - startTime)) <= 0)); - } - - public boolean block() { - if (Thread.interrupted()) { - wasInterrupted = true; - if (interruptible) - return true; - } - if (!timed) - LockSupport.park(this); - else { - long waitTime = nanos - (System.nanoTime() - startTime); - if (waitTime <= 0) - return true; - LockSupport.parkNanos(this, waitTime); - } - return isReleasable(); - } - - void signal() { - Thread t = thread; - if (t != null) { - thread = null; - LockSupport.unpark(t); - } - } - - boolean doWait() { - if (thread != null) { - try { - ForkJoinPool.managedBlock(this, false); - } catch (InterruptedException ie) { - } - } - return wasInterrupted; - } - - } - - /** - * Removes and signals waiting threads from wait queue. - */ - private void releaseWaiters(int phase) { - AtomicReference head = queueFor(phase); - QNode q; - while ((q = head.get()) != null) { - if (head.compareAndSet(q, q.next)) - q.signal(); - } - } - - /** - * Tries to enqueue given node in the appropriate wait queue. - * - * @return true if successful - */ - private boolean tryEnqueue(QNode node) { - AtomicReference head = queueFor(node.phase); - return head.compareAndSet(node.next = head.get(), node); - } - - /** - * Enqueues node and waits unless aborted or signalled. - * - * @return current phase - */ - private int untimedWait(int phase) { - QNode node = null; - boolean queued = false; - boolean interrupted = false; - int p; - while ((p = getPhase()) == phase) { - if (Thread.interrupted()) - interrupted = true; - else if (node == null) - node = new QNode(this, phase, false, false, 0, 0); - else if (!queued) - queued = tryEnqueue(node); - else - interrupted = node.doWait(); - } - if (node != null) - node.thread = null; - releaseWaiters(phase); - if (interrupted) - Thread.currentThread().interrupt(); - return p; - } - - /** - * Interruptible version - * - * @return current phase - */ - private int interruptibleWait(int phase) throws InterruptedException { - QNode node = null; - boolean queued = false; - boolean interrupted = false; - int p; - while ((p = getPhase()) == phase && !interrupted) { - if (Thread.interrupted()) - interrupted = true; - else if (node == null) - node = new QNode(this, phase, true, false, 0, 0); - else if (!queued) - queued = tryEnqueue(node); - else - interrupted = node.doWait(); - } - if (node != null) - node.thread = null; - if (p != phase || (p = getPhase()) != phase) - releaseWaiters(phase); - if (interrupted) - throw new InterruptedException(); - return p; - } - - /** - * Timeout version. - * - * @return current phase - */ - private int timedWait(int phase, long nanos) - throws InterruptedException, TimeoutException { - long startTime = System.nanoTime(); - QNode node = null; - boolean queued = false; - boolean interrupted = false; - int p; - while ((p = getPhase()) == phase && !interrupted) { - if (Thread.interrupted()) - interrupted = true; - else if (nanos - (System.nanoTime() - startTime) <= 0) - break; - else if (node == null) - node = new QNode(this, phase, true, true, startTime, nanos); - else if (!queued) - queued = tryEnqueue(node); - else - interrupted = node.doWait(); - } - if (node != null) - node.thread = null; - if (p != phase || (p = getPhase()) != phase) - releaseWaiters(phase); - if (interrupted) - throw new InterruptedException(); - if (p == phase) - throw new TimeoutException(); - return p; - } - - // Unsafe mechanics - - private static final sun.misc.Unsafe UNSAFE = getUnsafe(); - private static final long stateOffset = - objectFieldOffset("state", Phaser.class); - - private final boolean casState(long cmp, long val) { - return UNSAFE.compareAndSwapLong(this, stateOffset, cmp, val); - } - - private static long objectFieldOffset(String field, Class klazz) { - try { - return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field)); - } catch (NoSuchFieldException e) { - // Convert Exception to corresponding Error - NoSuchFieldError error = new NoSuchFieldError(field); - error.initCause(e); - throw error; - } - } - - /** - * Returns a sun.misc.Unsafe. Suitable for use in a 3rd party package. - * Replace with a simple call to Unsafe.getUnsafe when integrating - * into a jdk. - * - * @return a sun.misc.Unsafe - */ - private static sun.misc.Unsafe getUnsafe() { - try { - return sun.misc.Unsafe.getUnsafe(); - } catch (SecurityException se) { - try { - return java.security.AccessController.doPrivileged - (new java.security - .PrivilegedExceptionAction() { - public sun.misc.Unsafe run() throws Exception { - java.lang.reflect.Field f = sun.misc - .Unsafe.class.getDeclaredField("theUnsafe"); - f.setAccessible(true); - return (sun.misc.Unsafe) f.get(null); - } - }); - } catch (java.security.PrivilegedActionException e) { - throw new RuntimeException("Could not initialize intrinsics", - e.getCause()); - } - } - } -} diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/RecursiveAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/RecursiveAction.java deleted file mode 100644 index d227b8a360d..00000000000 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/RecursiveAction.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Licensed to Elastic Search and Shay Banon under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. Elastic Search 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. - */ - -/* - * Written by Doug Lea with assistance from members of JCP JSR-166 - * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain - */ - -package org.elasticsearch.util.concurrent.jsr166y; - -/** - * A recursive resultless {@link ForkJoinTask}. This class - * establishes conventions to parameterize resultless actions as - * {@code Void} {@code ForkJoinTask}s. Because {@code null} is the - * only valid value of type {@code Void}, methods such as join always - * return {@code null} upon completion. - * - *

Sample Usages. Here is a sketch of a ForkJoin sort that - * sorts a given {@code long[]} array: - * - *

 {@code
- * class SortTask extends RecursiveAction {
- *   final long[] array; final int lo; final int hi;
- *   SortTask(long[] array, int lo, int hi) {
- *     this.array = array; this.lo = lo; this.hi = hi;
- *   }
- *   protected void compute() {
- *     if (hi - lo < THRESHOLD)
- *       sequentiallySort(array, lo, hi);
- *     else {
- *       int mid = (lo + hi) >>> 1;
- *       invokeAll(new SortTask(array, lo, mid),
- *                 new SortTask(array, mid, hi));
- *       merge(array, lo, hi);
- *     }
- *   }
- * }}
- * - * You could then sort {@code anArray} by creating {@code new - * SortTask(anArray, 0, anArray.length-1) } and invoking it in a - * ForkJoinPool. As a more concrete simple example, the following - * task increments each element of an array: - *
 {@code
- * class IncrementTask extends RecursiveAction {
- *   final long[] array; final int lo; final int hi;
- *   IncrementTask(long[] array, int lo, int hi) {
- *     this.array = array; this.lo = lo; this.hi = hi;
- *   }
- *   protected void compute() {
- *     if (hi - lo < THRESHOLD) {
- *       for (int i = lo; i < hi; ++i)
- *         array[i]++;
- *     }
- *     else {
- *       int mid = (lo + hi) >>> 1;
- *       invokeAll(new IncrementTask(array, lo, mid),
- *                 new IncrementTask(array, mid, hi));
- *     }
- *   }
- * }}
- * - *

The following example illustrates some refinements and idioms - * that may lead to better performance: RecursiveActions need not be - * fully recursive, so long as they maintain the basic - * divide-and-conquer approach. Here is a class that sums the squares - * of each element of a double array, by subdividing out only the - * right-hand-sides of repeated divisions by two, and keeping track of - * them with a chain of {@code next} references. It uses a dynamic - * threshold based on method {@code getSurplusQueuedTaskCount}, but - * counterbalances potential excess partitioning by directly - * performing leaf actions on unstolen tasks rather than further - * subdividing. - * - *

 {@code
- * double sumOfSquares(ForkJoinPool pool, double[] array) {
- *   int n = array.length;
- *   Applyer a = new Applyer(array, 0, n, null);
- *   pool.invoke(a);
- *   return a.result;
- * }
- *
- * class Applyer extends RecursiveAction {
- *   final double[] array;
- *   final int lo, hi;
- *   double result;
- *   Applyer next; // keeps track of right-hand-side tasks
- *   Applyer(double[] array, int lo, int hi, Applyer next) {
- *     this.array = array; this.lo = lo; this.hi = hi;
- *     this.next = next;
- *   }
- *
- *   double atLeaf(int l, int h) {
- *     double sum = 0;
- *     for (int i = l; i < h; ++i) // perform leftmost base step
- *       sum += array[i] * array[i];
- *     return sum;
- *   }
- *
- *   protected void compute() {
- *     int l = lo;
- *     int h = hi;
- *     Applyer right = null;
- *     while (h - l > 1 && getSurplusQueuedTaskCount() <= 3) {
- *        int mid = (l + h) >>> 1;
- *        right = new Applyer(array, mid, h, right);
- *        right.fork();
- *        h = mid;
- *     }
- *     double sum = atLeaf(l, h);
- *     while (right != null) {
- *        if (right.tryUnfork()) // directly calculate if not stolen
- *          sum += right.atLeaf(right.lo, right.hi);
- *       else {
- *          right.helpJoin();
- *          sum += right.result;
- *        }
- *        right = right.next;
- *      }
- *     result = sum;
- *   }
- * }}
- * - * @author Doug Lea - * @since 1.7 - */ -public abstract class RecursiveAction extends ForkJoinTask { - private static final long serialVersionUID = 5232453952276485070L; - - /** - * The main computation performed by this task. - */ - protected abstract void compute(); - - /** - * Always returns null. - */ - public final Void getRawResult() { - return null; - } - - /** - * Requires null completion value. - */ - protected final void setRawResult(Void mustBeNull) { - } - - /** - * Implements execution conventions for RecursiveActions. - */ - protected final boolean exec() { - compute(); - return true; - } - -} diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/RecursiveTask.java b/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/RecursiveTask.java deleted file mode 100644 index 12c9ec0fa78..00000000000 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/RecursiveTask.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Licensed to Elastic Search and Shay Banon under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. Elastic Search 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. - */ - -/* - * Written by Doug Lea with assistance from members of JCP JSR-166 - * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain - */ - -package org.elasticsearch.util.concurrent.jsr166y; - -/** - * A recursive result-bearing {@link ForkJoinTask}. - * - *

For a classic example, here is a task computing Fibonacci numbers: - * - *

 {@code
- * class Fibonacci extends RecursiveTask {
- *   final int n;
- *   Fibonacci(int n) { this.n = n; }
- *   Integer compute() {
- *     if (n <= 1)
- *        return n;
- *     Fibonacci f1 = new Fibonacci(n - 1);
- *     f1.fork();
- *     Fibonacci f2 = new Fibonacci(n - 2);
- *     return f2.compute() + f1.join();
- *   }
- * }}
- * - * However, besides being a dumb way to compute Fibonacci functions - * (there is a simple fast linear algorithm that you'd use in - * practice), this is likely to perform poorly because the smallest - * subtasks are too small to be worthwhile splitting up. Instead, as - * is the case for nearly all fork/join applications, you'd pick some - * minimum granularity size (for example 10 here) for which you always - * sequentially solve rather than subdividing. - * - * @author Doug Lea - * @since 1.7 - */ -public abstract class RecursiveTask extends ForkJoinTask { - private static final long serialVersionUID = 5232453952276485270L; - - /** - * The result of the computation. - */ - V result; - - /** - * The main computation performed by this task. - */ - protected abstract V compute(); - - public final V getRawResult() { - return result; - } - - protected final void setRawResult(V value) { - result = value; - } - - /** - * Implements execution conventions for RecursiveTask. - */ - protected final boolean exec() { - result = compute(); - return true; - } - -} diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/ThreadLocalRandom.java b/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/ThreadLocalRandom.java deleted file mode 100644 index cb84c763be3..00000000000 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/ThreadLocalRandom.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Licensed to Elastic Search and Shay Banon under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. Elastic Search 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. - */ - -/* - * Written by Doug Lea with assistance from members of JCP JSR-166 - * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain - */ - -package org.elasticsearch.util.concurrent.jsr166y; - -import java.util.Random; - -/** - * A random number generator isolated to the current thread. Like the - * global {@link java.util.Random} generator used by the {@link - * java.lang.Math} class, a {@code ThreadLocalRandom} is initialized - * with an internally generated seed that may not otherwise be - * modified. When applicable, use of {@code ThreadLocalRandom} rather - * than shared {@code Random} objects in concurrent programs will - * typically encounter much less overhead and contention. Use of - * {@code ThreadLocalRandom} is particularly appropriate when multiple - * tasks (for example, each a {@link ForkJoinTask}) use random numbers - * in parallel in thread pools. - * - *

Usages of this class should typically be of the form: - * {@code ThreadLocalRandom.current().nextX(...)} (where - * {@code X} is {@code Int}, {@code Long}, etc). - * When all usages are of this form, it is never possible to - * accidently share a {@code ThreadLocalRandom} across multiple threads. - * - *

This class also provides additional commonly used bounded random - * generation methods. - * - * @author Doug Lea - * @since 1.7 - */ -public class ThreadLocalRandom extends Random { - // same constants as Random, but must be redeclared because private - private final static long multiplier = 0x5DEECE66DL; - private final static long addend = 0xBL; - private final static long mask = (1L << 48) - 1; - - /** - * The random seed. We can't use super.seed. - */ - private long rnd; - - /** - * Initialization flag to permit the first and only allowed call - * to setSeed (inside Random constructor) to succeed. We can't - * allow others since it would cause setting seed in one part of a - * program to unintentionally impact other usages by the thread. - */ - boolean initialized; - - // Padding to help avoid memory contention among seed updates in - // different TLRs in the common case that they are located near - // each other. - private long pad0, pad1, pad2, pad3, pad4, pad5, pad6, pad7; - - /** - * The actual ThreadLocal - */ - private static final ThreadLocal localRandom = - new ThreadLocal() { - protected ThreadLocalRandom initialValue() { - return new ThreadLocalRandom(); - } - }; - - - /** - * Constructor called only by localRandom.initialValue. - * We rely on the fact that the superclass no-arg constructor - * invokes setSeed exactly once to initialize. - */ - ThreadLocalRandom() { - super(); - } - - /** - * Returns the current thread's {@code ThreadLocalRandom}. - * - * @return the current thread's {@code ThreadLocalRandom} - */ - public static ThreadLocalRandom current() { - return localRandom.get(); - } - - /** - * Throws {@code UnsupportedOperationException}. Setting seeds in - * this generator is not supported. - * - * @throws UnsupportedOperationException always - */ - public void setSeed(long seed) { - if (initialized) - throw new UnsupportedOperationException(); - initialized = true; - rnd = (seed ^ multiplier) & mask; - } - - protected int next(int bits) { - rnd = (rnd * multiplier + addend) & mask; - return (int) (rnd >>> (48 - bits)); - } - - /** - * Returns a pseudorandom, uniformly distributed value between the - * given least value (inclusive) and bound (exclusive). - * - * @param least the least value returned - * @param bound the upper bound (exclusive) - * @return the next value - * @throws IllegalArgumentException if least greater than or equal - * to bound - */ - public int nextInt(int least, int bound) { - if (least >= bound) - throw new IllegalArgumentException(); - return nextInt(bound - least) + least; - } - - /** - * Returns a pseudorandom, uniformly distributed value - * between 0 (inclusive) and the specified value (exclusive). - * - * @param n the bound on the random number to be returned. Must be - * positive. - * @return the next value - * @throws IllegalArgumentException if n is not positive - */ - public long nextLong(long n) { - if (n <= 0) - throw new IllegalArgumentException("n must be positive"); - // Divide n by two until small enough for nextInt. On each - // iteration (at most 31 of them but usually much less), - // randomly choose both whether to include high bit in result - // (offset) and whether to continue with the lower vs upper - // half (which makes a difference only if odd). - long offset = 0; - while (n >= Integer.MAX_VALUE) { - int bits = next(2); - long half = n >>> 1; - long nextn = ((bits & 2) == 0) ? half : n - half; - if ((bits & 1) == 0) - offset += n - nextn; - n = nextn; - } - return offset + nextInt((int) n); - } - - /** - * Returns a pseudorandom, uniformly distributed value between the - * given least value (inclusive) and bound (exclusive). - * - * @param least the least value returned - * @param bound the upper bound (exclusive) - * @return the next value - * @throws IllegalArgumentException if least greater than or equal - * to bound - */ - public long nextLong(long least, long bound) { - if (least >= bound) - throw new IllegalArgumentException(); - return nextLong(bound - least) + least; - } - - /** - * Returns a pseudorandom, uniformly distributed {@code double} value - * between 0 (inclusive) and the specified value (exclusive). - * - * @param n the bound on the random number to be returned. Must be - * positive. - * @return the next value - * @throws IllegalArgumentException if n is not positive - */ - public double nextDouble(double n) { - if (n <= 0) - throw new IllegalArgumentException("n must be positive"); - return nextDouble() * n; - } - - /** - * Returns a pseudorandom, uniformly distributed value between the - * given least value (inclusive) and bound (exclusive). - * - * @param least the least value returned - * @param bound the upper bound (exclusive) - * @return the next value - * @throws IllegalArgumentException if least greater than or equal - * to bound - */ - public double nextDouble(double least, double bound) { - if (least >= bound) - throw new IllegalArgumentException(); - return nextDouble() * (bound - least) + least; - } - - private static final long serialVersionUID = -5851777807851030925L; -} diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/TransferQueue.java b/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/TransferQueue.java deleted file mode 100644 index dba54e0c92e..00000000000 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/TransferQueue.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Licensed to Elastic Search and Shay Banon under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. Elastic Search 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. - */ - -/* - * Written by Doug Lea with assistance from members of JCP JSR-166 - * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain - */ - -package org.elasticsearch.util.concurrent.jsr166y; - -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.SynchronousQueue; -import java.util.concurrent.TimeUnit; - -/** - * A {@link BlockingQueue} in which producers may wait for consumers - * to receive elements. A {@code TransferQueue} may be useful for - * example in message passing applications in which producers - * sometimes (using method {@link #transfer}) await receipt of - * elements by consumers invoking {@code take} or {@code poll}, while - * at other times enqueue elements (via method {@code put}) without - * waiting for receipt. - * {@linkplain #tryTransfer(Object) Non-blocking} and - * {@linkplain #tryTransfer(Object,long,TimeUnit) time-out} versions of - * {@code tryTransfer} are also available. - * A {@code TransferQueue} may also be queried, via {@link - * #hasWaitingConsumer}, whether there are any threads waiting for - * items, which is a converse analogy to a {@code peek} operation. - * - *

Like other blocking queues, a {@code TransferQueue} may be - * capacity bounded. If so, an attempted transfer operation may - * initially block waiting for available space, and/or subsequently - * block waiting for reception by a consumer. Note that in a queue - * with zero capacity, such as {@link SynchronousQueue}, {@code put} - * and {@code transfer} are effectively synonymous. - * - *

This interface is a member of the - * - * Java Collections Framework. - * - * @author Doug Lea - * @param the type of elements held in this collection - * @since 1.7 - */ -public interface TransferQueue extends BlockingQueue { - /** - * Transfers the element to a waiting consumer immediately, if possible. - * - *

More precisely, transfers the specified element immediately - * if there exists a consumer already waiting to receive it (in - * {@link #take} or timed {@link #poll(long,TimeUnit) poll}), - * otherwise returning {@code false} without enqueuing the element. - * - * @param e the element to transfer - * @return {@code true} if the element was transferred, else - * {@code false} - * @throws ClassCastException if the class of the specified element - * prevents it from being added to this queue - * @throws NullPointerException if the specified element is null - * @throws IllegalArgumentException if some property of the specified - * element prevents it from being added to this queue - */ - boolean tryTransfer(E e); - - /** - * Transfers the element to a consumer, waiting if necessary to do so. - * - *

More precisely, transfers the specified element immediately - * if there exists a consumer already waiting to receive it (in - * {@link #take} or timed {@link #poll(long,TimeUnit) poll}), - * else waits until the element is received by a consumer. - * - * @param e the element to transfer - * @throws InterruptedException if interrupted while waiting, - * in which case the element is not left enqueued - * @throws ClassCastException if the class of the specified element - * prevents it from being added to this queue - * @throws NullPointerException if the specified element is null - * @throws IllegalArgumentException if some property of the specified - * element prevents it from being added to this queue - */ - void transfer(E e) throws InterruptedException; - - /** - * Transfers the element to a consumer if it is possible to do so - * before the timeout elapses. - * - *

More precisely, transfers the specified element immediately - * if there exists a consumer already waiting to receive it (in - * {@link #take} or timed {@link #poll(long,TimeUnit) poll}), - * else waits until the element is received by a consumer, - * returning {@code false} if the specified wait time elapses - * before the element can be transferred. - * - * @param e the element to transfer - * @param timeout how long to wait before giving up, in units of - * {@code unit} - * @param unit a {@code TimeUnit} determining how to interpret the - * {@code timeout} parameter - * @return {@code true} if successful, or {@code false} if - * the specified waiting time elapses before completion, - * in which case the element is not left enqueued - * @throws InterruptedException if interrupted while waiting, - * in which case the element is not left enqueued - * @throws ClassCastException if the class of the specified element - * prevents it from being added to this queue - * @throws NullPointerException if the specified element is null - * @throws IllegalArgumentException if some property of the specified - * element prevents it from being added to this queue - */ - boolean tryTransfer(E e, long timeout, TimeUnit unit) - throws InterruptedException; - - /** - * Returns {@code true} if there is at least one consumer waiting - * to receive an element via {@link #take} or - * timed {@link #poll(long,TimeUnit) poll}. - * The return value represents a momentary state of affairs. - * - * @return {@code true} if there is at least one waiting consumer - */ - boolean hasWaitingConsumer(); - - /** - * Returns an estimate of the number of consumers waiting to - * receive elements via {@link #take} or timed - * {@link #poll(long,TimeUnit) poll}. The return value is an - * approximation of a momentary state of affairs, that may be - * inaccurate if consumers have completed or given up waiting. - * The value may be useful for monitoring and heuristics, but - * not for synchronization control. Implementations of this - * method are likely to be noticeably slower than those for - * {@link #hasWaitingConsumer}. - * - * @return the number of consumers waiting to receive elements - */ - int getWaitingConsumerCount(); -} diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/package-info.java b/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/package-info.java deleted file mode 100644 index d12a4b6713b..00000000000 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/concurrent/jsr166y/package-info.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to Elastic Search and Shay Banon under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. Elastic Search 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. - */ - -/* - * Written by Doug Lea with assistance from members of JCP JSR-166 - * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain - */ - - -/** - * Preview versions of classes targeted for Java 7. Includes a - * fine-grained parallel computation framework: ForkJoinTasks and - * their related support classes provide a very efficient basis for - * obtaining platform-independent parallel speed-ups of - * computation-intensive operations. They are not a full substitute - * for the kinds of arbitrary processing supported by Executors or - * Threads. However, when applicable, they typically provide - * significantly greater performance on multiprocessor platforms. - * - *

Candidates for fork/join processing mainly include those that - * can be expressed using parallel divide-and-conquer techniques: To - * solve a problem, break it in two (or more) parts, and then solve - * those parts in parallel, continuing on in this way until the - * problem is too small to be broken up, so is solved directly. The - * underlying work-stealing framework makes subtasks - * available to other threads (normally one per CPU), that help - * complete the tasks. In general, the most efficient ForkJoinTasks - * are those that directly implement this algorithmic design pattern. - */ -package org.elasticsearch.util.concurrent.jsr166y; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/serialization/ClusterSerializationTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/serialization/ClusterSerializationTests.java index 340988f4c58..51194358283 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/serialization/ClusterSerializationTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/cluster/serialization/ClusterSerializationTests.java @@ -25,10 +25,10 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.cluster.routing.strategy.DefaultShardsRoutingStrategy; +import org.elasticsearch.common.io.stream.BytesStreamInput; +import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.transport.DummyTransportAddress; -import org.elasticsearch.util.io.stream.BytesStreamInput; -import org.elasticsearch.util.io.stream.BytesStreamOutput; import org.testng.annotations.Test; import static org.elasticsearch.cluster.ClusterState.*; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/util/io/StreamsTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/common/io/StreamsTests.java similarity index 97% rename from modules/elasticsearch/src/test/java/org/elasticsearch/util/io/StreamsTests.java rename to modules/elasticsearch/src/test/java/org/elasticsearch/common/io/StreamsTests.java index baac4c0b203..7a45131217f 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/util/io/StreamsTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/common/io/StreamsTests.java @@ -17,14 +17,14 @@ * under the License. */ -package org.elasticsearch.util.io; +package org.elasticsearch.common.io; import org.testng.annotations.Test; import java.io.*; import java.util.Arrays; -import static org.elasticsearch.util.io.Streams.*; +import static org.elasticsearch.common.io.Streams.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/util/io/compressor/AbstractCompressorTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/common/io/compressor/AbstractCompressorTests.java similarity index 95% rename from modules/elasticsearch/src/test/java/org/elasticsearch/util/io/compressor/AbstractCompressorTests.java rename to modules/elasticsearch/src/test/java/org/elasticsearch/common/io/compressor/AbstractCompressorTests.java index 38776b1d0c0..2f0b9e465ac 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/util/io/compressor/AbstractCompressorTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/common/io/compressor/AbstractCompressorTests.java @@ -17,9 +17,9 @@ * under the License. */ -package org.elasticsearch.util.io.compressor; +package org.elasticsearch.common.io.compressor; -import org.elasticsearch.util.io.compression.Compressor; +import org.elasticsearch.common.io.compression.Compressor; import org.testng.annotations.Test; import static org.hamcrest.MatcherAssert.*; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/util/io/compressor/GZIPCompressorTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/common/io/compressor/GZIPCompressorTests.java similarity index 85% rename from modules/elasticsearch/src/test/java/org/elasticsearch/util/io/compressor/GZIPCompressorTests.java rename to modules/elasticsearch/src/test/java/org/elasticsearch/common/io/compressor/GZIPCompressorTests.java index dd981e8c723..9cc62d87902 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/util/io/compressor/GZIPCompressorTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/common/io/compressor/GZIPCompressorTests.java @@ -17,10 +17,10 @@ * under the License. */ -package org.elasticsearch.util.io.compressor; +package org.elasticsearch.common.io.compressor; -import org.elasticsearch.util.io.compression.Compressor; -import org.elasticsearch.util.io.compression.GZIPCompressor; +import org.elasticsearch.common.io.compression.Compressor; +import org.elasticsearch.common.io.compression.GZIPCompressor; /** * @author kimchy (Shay Banon) diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/util/io/compressor/LzpCompressorTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/common/io/compressor/LzpCompressorTests.java similarity index 85% rename from modules/elasticsearch/src/test/java/org/elasticsearch/util/io/compressor/LzpCompressorTests.java rename to modules/elasticsearch/src/test/java/org/elasticsearch/common/io/compressor/LzpCompressorTests.java index 89d54cc157a..cb55e794393 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/util/io/compressor/LzpCompressorTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/common/io/compressor/LzpCompressorTests.java @@ -17,10 +17,10 @@ * under the License. */ -package org.elasticsearch.util.io.compressor; +package org.elasticsearch.common.io.compressor; -import org.elasticsearch.util.io.compression.Compressor; -import org.elasticsearch.util.io.compression.LzfCompressor; +import org.elasticsearch.common.io.compression.Compressor; +import org.elasticsearch.common.io.compression.LzfCompressor; /** * @author kimchy (Shay Banon) diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/util/io/compressor/ZipCompressorTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/common/io/compressor/ZipCompressorTests.java similarity index 85% rename from modules/elasticsearch/src/test/java/org/elasticsearch/util/io/compressor/ZipCompressorTests.java rename to modules/elasticsearch/src/test/java/org/elasticsearch/common/io/compressor/ZipCompressorTests.java index afe5a8a6086..c8658692018 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/util/io/compressor/ZipCompressorTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/common/io/compressor/ZipCompressorTests.java @@ -17,10 +17,10 @@ * under the License. */ -package org.elasticsearch.util.io.compressor; +package org.elasticsearch.common.io.compressor; -import org.elasticsearch.util.io.compression.Compressor; -import org.elasticsearch.util.io.compression.ZipCompressor; +import org.elasticsearch.common.io.compression.Compressor; +import org.elasticsearch.common.io.compression.ZipCompressor; /** * @author kimchy (Shay Banon) diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/util/io/streams/BytesStreamsTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/common/io/streams/BytesStreamsTests.java similarity index 92% rename from modules/elasticsearch/src/test/java/org/elasticsearch/util/io/streams/BytesStreamsTests.java rename to modules/elasticsearch/src/test/java/org/elasticsearch/common/io/streams/BytesStreamsTests.java index a2fd120760e..4cde9848a81 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/util/io/streams/BytesStreamsTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/common/io/streams/BytesStreamsTests.java @@ -17,10 +17,10 @@ * under the License. */ -package org.elasticsearch.util.io.streams; +package org.elasticsearch.common.io.streams; -import org.elasticsearch.util.io.stream.BytesStreamInput; -import org.elasticsearch.util.io.stream.BytesStreamOutput; +import org.elasticsearch.common.io.stream.BytesStreamInput; +import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.testng.annotations.Test; import static org.hamcrest.MatcherAssert.*; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/util/io/streams/HandlesStreamsTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/common/io/streams/HandlesStreamsTests.java similarity index 87% rename from modules/elasticsearch/src/test/java/org/elasticsearch/util/io/streams/HandlesStreamsTests.java rename to modules/elasticsearch/src/test/java/org/elasticsearch/common/io/streams/HandlesStreamsTests.java index 7bb3beb030f..ad3add72790 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/util/io/streams/HandlesStreamsTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/common/io/streams/HandlesStreamsTests.java @@ -17,12 +17,12 @@ * under the License. */ -package org.elasticsearch.util.io.streams; +package org.elasticsearch.common.io.streams; -import org.elasticsearch.util.io.stream.BytesStreamInput; -import org.elasticsearch.util.io.stream.BytesStreamOutput; -import org.elasticsearch.util.io.stream.HandlesStreamInput; -import org.elasticsearch.util.io.stream.HandlesStreamOutput; +import org.elasticsearch.common.io.stream.BytesStreamInput; +import org.elasticsearch.common.io.stream.BytesStreamOutput; +import org.elasticsearch.common.io.stream.HandlesStreamInput; +import org.elasticsearch.common.io.stream.HandlesStreamOutput; import org.testng.annotations.Test; import static org.hamcrest.MatcherAssert.*; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/util/concurrent/resource/AbstractAcquirableResourceTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/common/util/concurrent/resource/AbstractAcquirableResourceTests.java similarity index 97% rename from modules/elasticsearch/src/test/java/org/elasticsearch/util/concurrent/resource/AbstractAcquirableResourceTests.java rename to modules/elasticsearch/src/test/java/org/elasticsearch/common/util/concurrent/resource/AbstractAcquirableResourceTests.java index 4e73ceb2c1d..78430c74f15 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/util/concurrent/resource/AbstractAcquirableResourceTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/common/util/concurrent/resource/AbstractAcquirableResourceTests.java @@ -17,11 +17,11 @@ * under the License. */ -package org.elasticsearch.util.concurrent.resource; +package org.elasticsearch.common.util.concurrent.resource; import org.elasticsearch.ElasticSearchException; +import org.elasticsearch.common.lease.Releasable; import org.elasticsearch.util.StopWatch; -import org.elasticsearch.util.lease.Releasable; import org.testng.annotations.Test; import java.util.ArrayList; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/util/concurrent/resource/BlockingAcquirableResourceTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/common/util/concurrent/resource/BlockingAcquirableResourceTests.java similarity index 90% rename from modules/elasticsearch/src/test/java/org/elasticsearch/util/concurrent/resource/BlockingAcquirableResourceTests.java rename to modules/elasticsearch/src/test/java/org/elasticsearch/common/util/concurrent/resource/BlockingAcquirableResourceTests.java index 0efe3f4db16..99466e6a63c 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/util/concurrent/resource/BlockingAcquirableResourceTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/common/util/concurrent/resource/BlockingAcquirableResourceTests.java @@ -17,9 +17,9 @@ * under the License. */ -package org.elasticsearch.util.concurrent.resource; +package org.elasticsearch.common.util.concurrent.resource; -import org.elasticsearch.util.lease.Releasable; +import org.elasticsearch.common.lease.Releasable; /** * @author kimchy diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/util/concurrent/resource/NonBlockingAcquirableResourceTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/common/util/concurrent/resource/NonBlockingAcquirableResourceTests.java similarity index 90% rename from modules/elasticsearch/src/test/java/org/elasticsearch/util/concurrent/resource/NonBlockingAcquirableResourceTests.java rename to modules/elasticsearch/src/test/java/org/elasticsearch/common/util/concurrent/resource/NonBlockingAcquirableResourceTests.java index 124322d1181..c09a6ca6c9d 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/util/concurrent/resource/NonBlockingAcquirableResourceTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/common/util/concurrent/resource/NonBlockingAcquirableResourceTests.java @@ -17,9 +17,9 @@ * under the License. */ -package org.elasticsearch.util.concurrent.resource; +package org.elasticsearch.common.util.concurrent.resource; -import org.elasticsearch.util.lease.Releasable; +import org.elasticsearch.common.lease.Releasable; /** * @author kimchy diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/builder/XContentBuilderTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/builder/XContentBuilderTests.java index 79eece52c8b..3a5f3341c21 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/builder/XContentBuilderTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/builder/XContentBuilderTests.java @@ -19,11 +19,11 @@ package org.elasticsearch.common.xcontent.builder; +import org.elasticsearch.common.io.FastByteArrayOutputStream; +import org.elasticsearch.common.io.FastCharArrayWriter; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentGenerator; import org.elasticsearch.common.xcontent.XContentType; -import org.elasticsearch.util.io.FastByteArrayOutputStream; -import org.elasticsearch.util.io.FastCharArrayWriter; import org.testng.annotations.Test; import static org.elasticsearch.common.xcontent.builder.XContentBuilder.FieldCaseConversion.*; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/xson/JsonVsXsonTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/xson/JsonVsXsonTests.java index 6d8268213c3..ce8241fc6f7 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/xson/JsonVsXsonTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/common/xcontent/xson/JsonVsXsonTests.java @@ -19,11 +19,11 @@ package org.elasticsearch.common.xcontent.xson; +import org.elasticsearch.common.io.FastByteArrayOutputStream; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentGenerator; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; -import org.elasticsearch.util.io.FastByteArrayOutputStream; import org.testng.annotations.Test; import java.io.IOException; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/deps/jackson/JacksonLocationTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/deps/jackson/JacksonLocationTests.java index 3c530bcf18f..9fb92487ae6 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/deps/jackson/JacksonLocationTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/deps/jackson/JacksonLocationTests.java @@ -19,8 +19,8 @@ package org.elasticsearch.deps.jackson; +import org.elasticsearch.common.io.FastByteArrayOutputStream; import org.elasticsearch.common.jackson.*; -import org.elasticsearch.util.io.FastByteArrayOutputStream; import org.testng.annotations.Test; import java.io.IOException; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/field/data/doubles/DoubleFieldDataTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/index/field/data/doubles/DoubleFieldDataTests.java index 0073a54dcf8..228e8f219dd 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/field/data/doubles/DoubleFieldDataTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/field/data/doubles/DoubleFieldDataTests.java @@ -24,16 +24,16 @@ import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.store.Directory; import org.apache.lucene.store.RAMDirectory; +import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.index.field.data.FieldData; -import org.elasticsearch.util.Tuple; import org.testng.annotations.Test; import java.util.ArrayList; +import static org.elasticsearch.common.collect.Tuple.*; import static org.elasticsearch.common.lucene.DocumentBuilder.*; import static org.elasticsearch.index.field.data.FieldDataOptions.*; -import static org.elasticsearch.util.Tuple.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/field/data/floats/FloatFieldDataTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/index/field/data/floats/FloatFieldDataTests.java index 7af1146054f..66a09bde108 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/field/data/floats/FloatFieldDataTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/field/data/floats/FloatFieldDataTests.java @@ -24,16 +24,16 @@ import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.store.Directory; import org.apache.lucene.store.RAMDirectory; +import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.index.field.data.FieldData; -import org.elasticsearch.util.Tuple; import org.testng.annotations.Test; import java.util.ArrayList; +import static org.elasticsearch.common.collect.Tuple.*; import static org.elasticsearch.common.lucene.DocumentBuilder.*; import static org.elasticsearch.index.field.data.FieldDataOptions.*; -import static org.elasticsearch.util.Tuple.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/field/data/ints/IntFieldDataTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/index/field/data/ints/IntFieldDataTests.java index 107a430af42..6bc9bf5899d 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/field/data/ints/IntFieldDataTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/field/data/ints/IntFieldDataTests.java @@ -24,16 +24,16 @@ import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.store.Directory; import org.apache.lucene.store.RAMDirectory; +import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.index.field.data.FieldData; -import org.elasticsearch.util.Tuple; import org.testng.annotations.Test; import java.util.ArrayList; +import static org.elasticsearch.common.collect.Tuple.*; import static org.elasticsearch.common.lucene.DocumentBuilder.*; import static org.elasticsearch.index.field.data.FieldDataOptions.*; -import static org.elasticsearch.util.Tuple.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/field/data/longs/LongFieldDataTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/index/field/data/longs/LongFieldDataTests.java index 694fee85bac..05ccf22060f 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/field/data/longs/LongFieldDataTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/field/data/longs/LongFieldDataTests.java @@ -24,16 +24,16 @@ import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.store.Directory; import org.apache.lucene.store.RAMDirectory; +import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.index.field.data.FieldData; -import org.elasticsearch.util.Tuple; import org.testng.annotations.Test; import java.util.ArrayList; +import static org.elasticsearch.common.collect.Tuple.*; import static org.elasticsearch.common.lucene.DocumentBuilder.*; import static org.elasticsearch.index.field.data.FieldDataOptions.*; -import static org.elasticsearch.util.Tuple.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/field/data/shorts/ShortFieldDataTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/index/field/data/shorts/ShortFieldDataTests.java index 6599ef8ef87..c1f0e30c242 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/field/data/shorts/ShortFieldDataTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/field/data/shorts/ShortFieldDataTests.java @@ -24,16 +24,16 @@ import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.store.Directory; import org.apache.lucene.store.RAMDirectory; +import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.index.field.data.FieldData; -import org.elasticsearch.util.Tuple; import org.testng.annotations.Test; import java.util.ArrayList; +import static org.elasticsearch.common.collect.Tuple.*; import static org.elasticsearch.common.lucene.DocumentBuilder.*; import static org.elasticsearch.index.field.data.FieldDataOptions.*; -import static org.elasticsearch.util.Tuple.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/field/data/strings/StringFieldDataTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/index/field/data/strings/StringFieldDataTests.java index 6f9e6e47f56..00884c8c59d 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/field/data/strings/StringFieldDataTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/field/data/strings/StringFieldDataTests.java @@ -23,16 +23,16 @@ import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.store.Directory; import org.apache.lucene.store.RAMDirectory; +import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.index.field.data.FieldData; -import org.elasticsearch.util.Tuple; import org.testng.annotations.Test; import java.util.ArrayList; +import static org.elasticsearch.common.collect.Tuple.*; import static org.elasticsearch.common.lucene.DocumentBuilder.*; import static org.elasticsearch.index.field.data.FieldDataOptions.*; -import static org.elasticsearch.util.Tuple.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/all/SimpleAllMapperTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/all/SimpleAllMapperTests.java index b9688eebd0d..bd00466bcb7 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/all/SimpleAllMapperTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/all/SimpleAllMapperTests.java @@ -29,7 +29,7 @@ import org.elasticsearch.index.mapper.xcontent.XContentDocumentMapper; import org.elasticsearch.index.mapper.xcontent.XContentDocumentMapperParser; import org.testng.annotations.Test; -import static org.elasticsearch.util.io.Streams.*; +import static org.elasticsearch.common.io.Streams.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/merge/test1/Test1MergeMapperTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/merge/test1/Test1MergeMapperTests.java index db12392b52e..87762aff563 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/merge/test1/Test1MergeMapperTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/merge/test1/Test1MergeMapperTests.java @@ -26,8 +26,8 @@ import org.elasticsearch.index.mapper.xcontent.XContentDocumentMapper; import org.elasticsearch.index.mapper.xcontent.XContentDocumentMapperParser; import org.testng.annotations.Test; +import static org.elasticsearch.common.io.Streams.*; import static org.elasticsearch.index.mapper.DocumentMapper.MergeFlags.*; -import static org.elasticsearch.util.io.Streams.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/multifield/XContentMultiFieldTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/multifield/XContentMultiFieldTests.java index 785ff55fd6b..ec7d74d6aa2 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/multifield/XContentMultiFieldTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/multifield/XContentMultiFieldTests.java @@ -27,8 +27,8 @@ import org.elasticsearch.index.mapper.xcontent.XContentDocumentMapper; import org.elasticsearch.index.mapper.xcontent.XContentDocumentMapperParser; import org.testng.annotations.Test; +import static org.elasticsearch.common.io.Streams.*; import static org.elasticsearch.index.mapper.xcontent.XContentMapperBuilders.*; -import static org.elasticsearch.util.io.Streams.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/multifield/merge/JavaMultiFieldMergeTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/multifield/merge/JavaMultiFieldMergeTests.java index 59806a04210..df40dcd2e6f 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/multifield/merge/JavaMultiFieldMergeTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/multifield/merge/JavaMultiFieldMergeTests.java @@ -27,8 +27,8 @@ import org.elasticsearch.index.mapper.xcontent.XContentDocumentMapper; import org.elasticsearch.index.mapper.xcontent.XContentDocumentMapperParser; import org.testng.annotations.Test; +import static org.elasticsearch.common.io.Streams.*; import static org.elasticsearch.index.mapper.DocumentMapper.MergeFlags.*; -import static org.elasticsearch.util.io.Streams.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/path/PathXContentMapperTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/path/PathXContentMapperTests.java index 03d57df533c..38c7ca03844 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/path/PathXContentMapperTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/path/PathXContentMapperTests.java @@ -27,7 +27,7 @@ import org.testng.annotations.Test; import java.io.IOException; -import static org.elasticsearch.util.io.Streams.*; +import static org.elasticsearch.common.io.Streams.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/simple/SimpleXContentMapperTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/simple/SimpleXContentMapperTests.java index b1b05af63e4..03734a2d8c1 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/simple/SimpleXContentMapperTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/xcontent/simple/SimpleXContentMapperTests.java @@ -29,8 +29,8 @@ import org.elasticsearch.index.mapper.xcontent.XContentDocumentMapperParser; import org.testng.annotations.Test; import static org.apache.lucene.document.Field.Store.*; +import static org.elasticsearch.common.io.Streams.*; import static org.elasticsearch.index.mapper.xcontent.XContentMapperBuilders.*; -import static org.elasticsearch.util.io.Streams.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/query/xcontent/SimpleIndexQueryParserTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/index/query/xcontent/SimpleIndexQueryParserTests.java index 17f224105ba..8d3182f5779 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/query/xcontent/SimpleIndexQueryParserTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/query/xcontent/SimpleIndexQueryParserTests.java @@ -41,10 +41,10 @@ import java.lang.reflect.Field; import java.util.List; import java.util.Set; +import static org.elasticsearch.common.io.Streams.*; import static org.elasticsearch.common.settings.ImmutableSettings.Builder.*; import static org.elasticsearch.index.query.xcontent.FilterBuilders.*; import static org.elasticsearch.index.query.xcontent.QueryBuilders.*; -import static org.elasticsearch.util.io.Streams.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/transport/AbstractSimpleTransportTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/transport/AbstractSimpleTransportTests.java index 5424c6a2da2..15c56e8be3c 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/transport/AbstractSimpleTransportTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/transport/AbstractSimpleTransportTests.java @@ -20,13 +20,13 @@ package org.elasticsearch.transport; import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.cached.CachedThreadPool; import org.elasticsearch.timer.TimerService; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/benchmark/BenchmarkMessage.java b/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/benchmark/BenchmarkMessage.java index 2ccdfce4593..f103c13ce04 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/benchmark/BenchmarkMessage.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/benchmark/BenchmarkMessage.java @@ -19,9 +19,9 @@ package org.elasticsearch.transport.netty.benchmark; -import org.elasticsearch.util.io.stream.StreamInput; -import org.elasticsearch.util.io.stream.StreamOutput; -import org.elasticsearch.util.io.stream.Streamable; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; import java.io.IOException; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/util/concurrent/BlockingThreadPoolTest.java b/modules/elasticsearch/src/test/java/org/elasticsearch/util/concurrent/BlockingThreadPoolTest.java index 25285ee71f3..9b74b83864e 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/util/concurrent/BlockingThreadPoolTest.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/util/concurrent/BlockingThreadPoolTest.java @@ -19,6 +19,8 @@ package org.elasticsearch.util.concurrent; +import org.elasticsearch.common.util.concurrent.DynamicExecutors; +import org.elasticsearch.common.util.concurrent.ThreadBarrier; import org.testng.annotations.Test; import java.util.concurrent.RejectedExecutionException; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/util/concurrent/ScalingThreadPoolTest.java b/modules/elasticsearch/src/test/java/org/elasticsearch/util/concurrent/ScalingThreadPoolTest.java index 7750bde76ce..82e519eeb45 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/util/concurrent/ScalingThreadPoolTest.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/util/concurrent/ScalingThreadPoolTest.java @@ -19,6 +19,8 @@ package org.elasticsearch.util.concurrent; +import org.elasticsearch.common.util.concurrent.DynamicExecutors; +import org.elasticsearch.common.util.concurrent.ThreadBarrier; import org.testng.annotations.Test; import java.util.concurrent.ThreadPoolExecutor; diff --git a/modules/jarjar/build.gradle b/modules/jarjar/build.gradle index 11c71fa0f5b..80cef9c43fa 100644 --- a/modules/jarjar/build.gradle +++ b/modules/jarjar/build.gradle @@ -10,6 +10,7 @@ dependencies { runtime 'com.google.guava:guava:r05' runtime 'org.elasticsearch:es-trove:2.1.0' + runtime 'org.elasticsearch:es-jsr166y:20100615' runtime 'joda-time:joda-time:1.6' runtime 'org.mvel:mvel2:2.0.17' @@ -36,7 +37,7 @@ jar << { jarjar(jarfile: jarjarArchivePath) { zipfileset(src: jar.archivePath) configurations.runtime.files.findAll {file -> - ['mvel', 'jackson', 'joda', 'snakeyaml', 'netty', 'async-http-client', 'guice', 'aopalliance', 'guava', 'trove'].any { file.name.contains(it) } + ['mvel', 'jackson', 'joda', 'snakeyaml', 'netty', 'async-http-client', 'guice', 'aopalliance', 'guava', 'trove', 'jsr166y'].any { file.name.contains(it) } }.each { jarjarFile -> zipfileset(src: jarjarFile) { exclude(name: "META-INF/**") @@ -44,6 +45,7 @@ jar << { } rule pattern: "com.google.common.**", result: "org.elasticsearch.common.@1" rule pattern: "gnu.trove.**", result: "org.elasticsearch.common.trove.@1" + rule pattern: "jsr166y.**", result: "org.elasticsearch.common.util.concurrent.jsr166y.@1" rule pattern: "org.aopalliance.**", result: "org.elasticsearch.common.aopalliance.@1" rule pattern: "com.google.inject.**", result: "org.elasticsearch.common.inject.@1" @@ -64,6 +66,7 @@ jar << { // seems like empty dirst still exists, unjar and clean them unjar(src: jar.archivePath, dest: "build/tmp/extracted") + delete(dir: "build/tmp/extracted/jsr166y") delete(dir: "build/tmp/extracted/gnu/trove") delete(dir: "build/tmp/extracted/org/codehaus") delete(dir: "build/tmp/extracted/org/aopalliance") diff --git a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/scriptfield/ScriptFieldSearchTests.java b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/scriptfield/ScriptFieldSearchTests.java index e7ce8ffc41e..72599161c07 100644 --- a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/scriptfield/ScriptFieldSearchTests.java +++ b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/scriptfield/ScriptFieldSearchTests.java @@ -21,8 +21,8 @@ package org.elasticsearch.test.integration.search.scriptfield; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.client.Client; +import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.test.integration.AbstractNodesTests; -import org.elasticsearch.util.MapBuilder; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; diff --git a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/terms/TermsActionTests.java b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/terms/TermsActionTests.java index 65034887b43..a2b71821c79 100644 --- a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/terms/TermsActionTests.java +++ b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/terms/TermsActionTests.java @@ -33,8 +33,8 @@ import org.testng.annotations.Test; import static org.elasticsearch.action.terms.TermsRequest.SortType.*; import static org.elasticsearch.client.Requests.*; +import static org.elasticsearch.common.collect.MapBuilder.*; import static org.elasticsearch.common.xcontent.XContentFactory.*; -import static org.elasticsearch.util.MapBuilder.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; diff --git a/plugins/cloud/src/main/java/org/elasticsearch/cloud/jclouds/JCloudsUtils.java b/plugins/cloud/src/main/java/org/elasticsearch/cloud/jclouds/JCloudsUtils.java index e6abe3b0b40..abc533705f3 100644 --- a/plugins/cloud/src/main/java/org/elasticsearch/cloud/jclouds/JCloudsUtils.java +++ b/plugins/cloud/src/main/java/org/elasticsearch/cloud/jclouds/JCloudsUtils.java @@ -23,7 +23,7 @@ import com.google.inject.Module; import org.elasticsearch.cloud.jclouds.logging.JCloudsLoggingModule; import org.elasticsearch.common.collect.ImmutableList; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.util.concurrent.DynamicExecutors; +import org.elasticsearch.common.util.concurrent.DynamicExecutors; import org.jclouds.concurrent.config.ExecutorServiceModule; import java.util.concurrent.Executors; diff --git a/plugins/cloud/src/main/java/org/elasticsearch/gateway/cloud/CloudGateway.java b/plugins/cloud/src/main/java/org/elasticsearch/gateway/cloud/CloudGateway.java index 6c8b02cd458..e33aa615921 100644 --- a/plugins/cloud/src/main/java/org/elasticsearch/gateway/cloud/CloudGateway.java +++ b/plugins/cloud/src/main/java/org/elasticsearch/gateway/cloud/CloudGateway.java @@ -27,6 +27,7 @@ import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Module; +import org.elasticsearch.common.io.FastByteArrayInputStream; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentFactory; @@ -37,7 +38,6 @@ import org.elasticsearch.gateway.Gateway; import org.elasticsearch.gateway.GatewayException; import org.elasticsearch.index.gateway.cloud.CloudIndexGatewayModule; import org.elasticsearch.util.SizeValue; -import org.elasticsearch.util.io.FastByteArrayInputStream; import org.jclouds.blobstore.BlobStoreContext; import org.jclouds.blobstore.domain.Blob; import org.jclouds.blobstore.domain.PageSet; diff --git a/plugins/cloud/src/main/java/org/elasticsearch/index/gateway/cloud/CloudIndexShardGateway.java b/plugins/cloud/src/main/java/org/elasticsearch/index/gateway/cloud/CloudIndexShardGateway.java index 3b6d11034cc..bfd17e4a918 100644 --- a/plugins/cloud/src/main/java/org/elasticsearch/index/gateway/cloud/CloudIndexShardGateway.java +++ b/plugins/cloud/src/main/java/org/elasticsearch/index/gateway/cloud/CloudIndexShardGateway.java @@ -28,6 +28,9 @@ import org.elasticsearch.cloud.blobstore.CloudBlobStoreService; import org.elasticsearch.common.collect.Lists; import org.elasticsearch.common.collect.Maps; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.FastByteArrayInputStream; +import org.elasticsearch.common.io.stream.BytesStreamOutput; +import org.elasticsearch.common.io.stream.InputStreamStreamInput; import org.elasticsearch.common.lucene.Directories; import org.elasticsearch.common.lucene.store.InputStreamIndexInput; import org.elasticsearch.common.lucene.store.ThreadSafeInputStreamIndexInput; @@ -49,9 +52,6 @@ import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.util.SizeUnit; import org.elasticsearch.util.SizeValue; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.FastByteArrayInputStream; -import org.elasticsearch.util.io.stream.BytesStreamOutput; -import org.elasticsearch.util.io.stream.InputStreamStreamInput; import org.jclouds.blobstore.BlobStoreContext; import org.jclouds.blobstore.domain.Blob; import org.jclouds.blobstore.domain.PageSet; diff --git a/plugins/discovery/jgroups/src/main/java/org/elasticsearch/discovery/jgroups/JgroupsDiscovery.java b/plugins/discovery/jgroups/src/main/java/org/elasticsearch/discovery/jgroups/JgroupsDiscovery.java index d3cc824303a..402b736b9cf 100644 --- a/plugins/discovery/jgroups/src/main/java/org/elasticsearch/discovery/jgroups/JgroupsDiscovery.java +++ b/plugins/discovery/jgroups/src/main/java/org/elasticsearch/discovery/jgroups/JgroupsDiscovery.java @@ -26,6 +26,8 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.BytesStreamInput; +import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.network.NetworkService; import org.elasticsearch.common.network.NetworkUtils; import org.elasticsearch.common.settings.Settings; @@ -34,8 +36,6 @@ import org.elasticsearch.discovery.DiscoveryException; import org.elasticsearch.discovery.InitialStateDiscoveryListener; import org.elasticsearch.env.Environment; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.util.io.stream.BytesStreamInput; -import org.elasticsearch.util.io.stream.BytesStreamOutput; import org.jgroups.*; import java.io.IOException; diff --git a/plugins/hadoop/src/main/java/org/elasticsearch/index/gateway/hdfs/HdfsIndexShardGateway.java b/plugins/hadoop/src/main/java/org/elasticsearch/index/gateway/hdfs/HdfsIndexShardGateway.java index c6d30a166d9..a63ec91d68d 100644 --- a/plugins/hadoop/src/main/java/org/elasticsearch/index/gateway/hdfs/HdfsIndexShardGateway.java +++ b/plugins/hadoop/src/main/java/org/elasticsearch/index/gateway/hdfs/HdfsIndexShardGateway.java @@ -25,6 +25,9 @@ import org.apache.lucene.store.IndexInput; import org.elasticsearch.ElasticSearchException; import org.elasticsearch.common.collect.Lists; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.DataInputStreamInput; +import org.elasticsearch.common.io.stream.DataOutputStreamOutput; +import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.lucene.Directories; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.deletionpolicy.SnapshotIndexCommit; @@ -44,9 +47,6 @@ import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.util.SizeUnit; import org.elasticsearch.util.SizeValue; import org.elasticsearch.util.TimeValue; -import org.elasticsearch.util.io.stream.DataInputStreamInput; -import org.elasticsearch.util.io.stream.DataOutputStreamOutput; -import org.elasticsearch.util.io.stream.StreamOutput; import java.io.EOFException; import java.io.FileNotFoundException; diff --git a/plugins/mapper/attachments/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentAttachmentMapper.java b/plugins/mapper/attachments/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentAttachmentMapper.java index 73c6605f8dd..dc1cf5b8f5e 100644 --- a/plugins/mapper/attachments/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentAttachmentMapper.java +++ b/plugins/mapper/attachments/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentAttachmentMapper.java @@ -21,12 +21,12 @@ package org.elasticsearch.index.mapper.xcontent; import org.apache.tika.exception.TikaException; import org.apache.tika.metadata.Metadata; +import org.elasticsearch.common.io.FastByteArrayInputStream; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.builder.XContentBuilder; import org.elasticsearch.index.mapper.FieldMapperListener; import org.elasticsearch.index.mapper.MapperParsingException; import org.elasticsearch.index.mapper.MergeMappingException; -import org.elasticsearch.util.io.FastByteArrayInputStream; import java.io.IOException; import java.util.Map; diff --git a/plugins/mapper/attachments/src/test/java/org/elasticsearch/index/mapper/xcontent/SimpleAttachmentMapperTests.java b/plugins/mapper/attachments/src/test/java/org/elasticsearch/index/mapper/xcontent/SimpleAttachmentMapperTests.java index 104f9b3baf4..3e1dfcb7fd2 100644 --- a/plugins/mapper/attachments/src/test/java/org/elasticsearch/index/mapper/xcontent/SimpleAttachmentMapperTests.java +++ b/plugins/mapper/attachments/src/test/java/org/elasticsearch/index/mapper/xcontent/SimpleAttachmentMapperTests.java @@ -25,8 +25,8 @@ import org.elasticsearch.index.analysis.AnalysisService; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; +import static org.elasticsearch.common.io.Streams.*; import static org.elasticsearch.common.xcontent.XContentFactory.*; -import static org.elasticsearch.util.io.Streams.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; diff --git a/plugins/mapper/attachments/src/test/java/org/elasticsearch/plugin/mapper/attachments/test/SimpleAttachmentIntegrationTests.java b/plugins/mapper/attachments/src/test/java/org/elasticsearch/plugin/mapper/attachments/test/SimpleAttachmentIntegrationTests.java index cbe0aa75479..fabd2495a95 100644 --- a/plugins/mapper/attachments/src/test/java/org/elasticsearch/plugin/mapper/attachments/test/SimpleAttachmentIntegrationTests.java +++ b/plugins/mapper/attachments/src/test/java/org/elasticsearch/plugin/mapper/attachments/test/SimpleAttachmentIntegrationTests.java @@ -28,11 +28,11 @@ import org.elasticsearch.node.Node; import org.testng.annotations.*; import static org.elasticsearch.client.Requests.*; +import static org.elasticsearch.common.io.Streams.*; import static org.elasticsearch.common.settings.ImmutableSettings.*; import static org.elasticsearch.common.xcontent.XContentFactory.*; import static org.elasticsearch.index.query.xcontent.QueryBuilders.*; import static org.elasticsearch.node.NodeBuilder.*; -import static org.elasticsearch.util.io.Streams.*; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.Matchers.*; diff --git a/plugins/transport/memcached/src/main/java/org/elasticsearch/memcached/netty/NettyMemcachedServerTransport.java b/plugins/transport/memcached/src/main/java/org/elasticsearch/memcached/netty/NettyMemcachedServerTransport.java index fe8359b703c..95f04f7af1e 100644 --- a/plugins/transport/memcached/src/main/java/org/elasticsearch/memcached/netty/NettyMemcachedServerTransport.java +++ b/plugins/transport/memcached/src/main/java/org/elasticsearch/memcached/netty/NettyMemcachedServerTransport.java @@ -47,7 +47,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicReference; import static org.elasticsearch.common.network.NetworkService.TcpSettings.*; -import static org.elasticsearch.util.concurrent.DynamicExecutors.*; +import static org.elasticsearch.common.util.concurrent.DynamicExecutors.*; /** * @author kimchy (shay.banon) diff --git a/plugins/transport/memcached/src/main/java/org/elasticsearch/memcached/netty/OpenChannelsHandler.java b/plugins/transport/memcached/src/main/java/org/elasticsearch/memcached/netty/OpenChannelsHandler.java index ba00e243c49..c3b756d57ee 100644 --- a/plugins/transport/memcached/src/main/java/org/elasticsearch/memcached/netty/OpenChannelsHandler.java +++ b/plugins/transport/memcached/src/main/java/org/elasticsearch/memcached/netty/OpenChannelsHandler.java @@ -20,7 +20,7 @@ package org.elasticsearch.memcached.netty; import org.elasticsearch.common.netty.channel.*; -import org.elasticsearch.util.concurrent.ConcurrentCollections; +import org.elasticsearch.common.util.concurrent.ConcurrentCollections; import java.util.Set;