Return-Path: Delivered-To: apmail-incubator-cassandra-commits-archive@minotaur.apache.org Received: (qmail 39493 invoked from network); 30 Jul 2009 15:31:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 30 Jul 2009 15:31:07 -0000 Received: (qmail 63179 invoked by uid 500); 30 Jul 2009 15:31:08 -0000 Delivered-To: apmail-incubator-cassandra-commits-archive@incubator.apache.org Received: (qmail 63148 invoked by uid 500); 30 Jul 2009 15:31:08 -0000 Mailing-List: contact cassandra-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cassandra-dev@incubator.apache.org Delivered-To: mailing list cassandra-commits@incubator.apache.org Received: (qmail 63138 invoked by uid 99); 30 Jul 2009 15:31:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Jul 2009 15:31:08 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Jul 2009 15:30:56 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id DA6B52388871; Thu, 30 Jul 2009 15:30:35 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r799331 [1/29] - in /incubator/cassandra/trunk: ./ src/java/org/apache/cassandra/concurrent/ src/java/org/apache/cassandra/config/ src/java/org/apache/cassandra/db/ src/java/org/apache/cassandra/dht/ src/java/org/apache/cassandra/gms/ src/j... Date: Thu, 30 Jul 2009 15:30:27 -0000 To: cassandra-commits@incubator.apache.org From: jbellis@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090730153035.DA6B52388871@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jbellis Date: Thu Jul 30 15:30:21 2009 New Revision: 799331 URL: http://svn.apache.org/viewvc?rev=799331&view=rev Log: run source files through dos2unix to standardize on \n line endings. patch by Jeff Hodges; reviewed by Michael Greene for CASSANDRA-111 Modified: incubator/cassandra/trunk/build.xml incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/AIOExecutorService.java incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/Context.java incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/ContinuationContext.java incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/ContinuationStage.java incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/DebuggableScheduledThreadPoolExecutor.java incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/IContinuable.java incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/IStage.java incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/MultiThreadedStage.java incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/RejectedExecutionHandler.java incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/SingleThreadedContinuationStage.java incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/SingleThreadedStage.java incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/StageManager.java incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/ThreadFactoryImpl.java incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/ThreadLocalContext.java incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryMemtable.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryMemtableManager.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryVerbHandler.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CalloutDeployMessage.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CalloutDeployVerbHandler.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CalloutManager.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Column.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamily.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyNotDefinedException.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnIndexer.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CommitLog.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CommitLogHeader.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CompactSerializerInvocationHandler.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/DBConstants.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/DataFileVerbHandler.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/FileNameComparator.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/FileStructComparator.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/HintedHandOffManager.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/IColumn.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/IScanner.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/LoadVerbHandler.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/MinorCompactionManager.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/PeriodicFlushManager.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ReadCommand.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ReadRepairVerbHandler.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ReadResponse.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ReadVerbHandler.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/RecoveryManager.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Row.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/RowMutation.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/RowMutationMessage.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/RowMutationVerbHandler.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Scanner.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SliceByNamesReadCommand.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SliceFromReadCommand.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SystemTable.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java incubator/cassandra/trunk/src/java/org/apache/cassandra/db/WriteResponse.java incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/BootstrapInitiateMessage.java incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/BootstrapMetadata.java incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/BootstrapMetadataMessage.java incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/BootstrapMetadataVerbHandler.java incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/BootstrapSourceTarget.java incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/IPartitioner.java incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/LeaveJoinProtocolHelper.java incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/LeaveJoinProtocolImpl.java incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/OrderPreservingPartitioner.java incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/RandomPartitioner.java incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/Range.java incubator/cassandra/trunk/src/java/org/apache/cassandra/gms/ApplicationState.java incubator/cassandra/trunk/src/java/org/apache/cassandra/gms/EndPointState.java incubator/cassandra/trunk/src/java/org/apache/cassandra/gms/FailureDetector.java incubator/cassandra/trunk/src/java/org/apache/cassandra/gms/FailureDetectorMBean.java incubator/cassandra/trunk/src/java/org/apache/cassandra/gms/GossipDigest.java incubator/cassandra/trunk/src/java/org/apache/cassandra/gms/GossipDigestAck2Message.java incubator/cassandra/trunk/src/java/org/apache/cassandra/gms/GossipDigestAckMessage.java incubator/cassandra/trunk/src/java/org/apache/cassandra/gms/GossipDigestSynMessage.java incubator/cassandra/trunk/src/java/org/apache/cassandra/gms/Gossiper.java incubator/cassandra/trunk/src/java/org/apache/cassandra/gms/HeartBeatState.java incubator/cassandra/trunk/src/java/org/apache/cassandra/gms/IEndPointStateChangePublisher.java incubator/cassandra/trunk/src/java/org/apache/cassandra/gms/IEndPointStateChangeSubscriber.java incubator/cassandra/trunk/src/java/org/apache/cassandra/gms/IFailureDetectionEventListener.java incubator/cassandra/trunk/src/java/org/apache/cassandra/gms/IFailureDetector.java incubator/cassandra/trunk/src/java/org/apache/cassandra/gms/IFailureNotification.java incubator/cassandra/trunk/src/java/org/apache/cassandra/gms/JoinMessage.java incubator/cassandra/trunk/src/java/org/apache/cassandra/gms/PureRandom.java incubator/cassandra/trunk/src/java/org/apache/cassandra/gms/VersionGenerator.java incubator/cassandra/trunk/src/java/org/apache/cassandra/io/BufferedRandomAccessFile.java incubator/cassandra/trunk/src/java/org/apache/cassandra/io/Coordinate.java incubator/cassandra/trunk/src/java/org/apache/cassandra/io/DataInputBuffer.java incubator/cassandra/trunk/src/java/org/apache/cassandra/io/DataOutputBuffer.java incubator/cassandra/trunk/src/java/org/apache/cassandra/io/FastBufferedInputStream.java incubator/cassandra/trunk/src/java/org/apache/cassandra/io/FastBufferedOutputStream.java incubator/cassandra/trunk/src/java/org/apache/cassandra/io/FileStruct.java incubator/cassandra/trunk/src/java/org/apache/cassandra/io/ICompactSerializer.java incubator/cassandra/trunk/src/java/org/apache/cassandra/io/IFileReader.java incubator/cassandra/trunk/src/java/org/apache/cassandra/io/IndexHelper.java incubator/cassandra/trunk/src/java/org/apache/cassandra/io/SSTable.java incubator/cassandra/trunk/src/java/org/apache/cassandra/io/SSTableReader.java incubator/cassandra/trunk/src/java/org/apache/cassandra/io/SequenceFile.java incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractStrategy.java incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/EndPointSnitch.java incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/IEndPointSnitch.java incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/IReplicaPlacementStrategy.java incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/RackAwareStrategy.java incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/RackUnawareStrategy.java incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/TokenMetadata.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/AsyncResult.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/CompactEndPointSerializationHelper.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/ConnectionStatistics.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/EndPoint.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/FileStreamTask.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/Header.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/HeaderTypes.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/IAsyncCallback.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/IAsyncResult.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/IMessagingService.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/IVerbHandler.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/Message.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MessageDeliveryTask.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MessageDeserializationTask.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MessageSerializationTask.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MessagingConfig.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MultiAsyncResult.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/ProtocolHeader.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/ResponseVerbHandler.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/SelectionKeyHandler.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/SelectorManager.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/TcpConnection.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/TcpConnectionHandler.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/TcpConnectionManager.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/UdpConnection.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/io/ContentLengthState.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/io/ContentState.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/io/ContentStreamState.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/io/DoneState.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/io/FastSerializer.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/io/ISerializer.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/io/IStreamComplete.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/io/ProtocolHeaderState.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/io/ProtocolState.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/io/ReadNotCompleteException.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/io/SerializerAttribute.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/io/SerializerType.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/io/StartState.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/io/StreamContextManager.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/io/TcpReader.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/sink/IMessageSink.java incubator/cassandra/trunk/src/java/org/apache/cassandra/net/sink/SinkManager.java incubator/cassandra/trunk/src/java/org/apache/cassandra/procedures/GroovyScriptRunner.java incubator/cassandra/trunk/src/java/org/apache/cassandra/service/ConsistencyManager.java incubator/cassandra/trunk/src/java/org/apache/cassandra/service/DigestMismatchException.java incubator/cassandra/trunk/src/java/org/apache/cassandra/service/IResponseResolver.java incubator/cassandra/trunk/src/java/org/apache/cassandra/service/LoadDisseminator.java incubator/cassandra/trunk/src/java/org/apache/cassandra/service/LoadInfo.java incubator/cassandra/trunk/src/java/org/apache/cassandra/service/MultiQuorumResponseHandler.java incubator/cassandra/trunk/src/java/org/apache/cassandra/service/QuorumResponseHandler.java incubator/cassandra/trunk/src/java/org/apache/cassandra/service/ReadRepairManager.java incubator/cassandra/trunk/src/java/org/apache/cassandra/service/ReadResponseResolver.java incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageLoadBalancer.java incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageServiceMBean.java incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StreamManager.java incubator/cassandra/trunk/src/java/org/apache/cassandra/service/TokenUpdateVerbHandler.java incubator/cassandra/trunk/src/java/org/apache/cassandra/service/WriteResponseResolver.java incubator/cassandra/trunk/src/java/org/apache/cassandra/tools/KeyChecker.java incubator/cassandra/trunk/src/java/org/apache/cassandra/tools/MembershipCleaner.java incubator/cassandra/trunk/src/java/org/apache/cassandra/tools/MembershipCleanerVerbHandler.java incubator/cassandra/trunk/src/java/org/apache/cassandra/tools/ThreadListBuilder.java incubator/cassandra/trunk/src/java/org/apache/cassandra/tools/TokenUpdateVerbHandler.java incubator/cassandra/trunk/src/java/org/apache/cassandra/tools/TokenUpdater.java incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/BasicUtilities.java incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/BloomCalculations.java incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/BloomFilter.java incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/Cachetable.java incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/FBUtilities.java incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/FastLinkedHashMap.java incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/FileUtils.java incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/GuidGenerator.java incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/HashingSchemes.java incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/ICacheExpungeHook.java incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/ICachetable.java incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/Log4jLogger.java incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/LogUtil.java incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/SafeMessageDigest.java incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java incubator/cassandra/trunk/test/unit/org/apache/cassandra/gms/GossipDigestTest.java Modified: incubator/cassandra/trunk/build.xml URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/build.xml?rev=799331&r1=799330&r2=799331&view=diff ============================================================================== --- incubator/cassandra/trunk/build.xml (original) +++ incubator/cassandra/trunk/build.xml Thu Jul 30 15:30:21 2009 @@ -1,4 +1,4 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Building Grammar ${build.src}/org/apache/cassandra/cli/Cli.g .... - - - - - - - - - - - - - - Building Grammar ${build.src}/org/apache/cassandra/cql/compiler/parse/Cql.g .... - - - - - - - - - Generating Thrift Java code from ${basedir}/interface/cassandra.thrift .... - - - - - - Generating Thrift Python code from ${basedir}/interface/cassandra.thrift .... - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Building Grammar ${build.src}/org/apache/cassandra/cli/Cli.g .... + + + + + + + + + + + + + + Building Grammar ${build.src}/org/apache/cassandra/cql/compiler/parse/Cql.g .... + + + + + + + + + Generating Thrift Java code from ${basedir}/interface/cassandra.thrift .... + + + + + + Generating Thrift Python code from ${basedir}/interface/cassandra.thrift .... + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/AIOExecutorService.java URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/AIOExecutorService.java?rev=799331&r1=799330&r2=799331&view=diff ============================================================================== --- incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/AIOExecutorService.java (original) +++ incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/AIOExecutorService.java Thu Jul 30 15:30:21 2009 @@ -1,319 +1,319 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF 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.apache.cassandra.concurrent; - -import java.util.Collection; -import java.util.List; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.RejectedExecutionException; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -public class AIOExecutorService implements ExecutorService -{ - private ExecutorService executorService_; - - public AIOExecutorService(int corePoolSize, - int maximumPoolSize, - long keepAliveTime, - TimeUnit unit, - BlockingQueue workQueue, - ThreadFactory threadFactory) - { - executorService_ = new ThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory); - } - - /** - * Executes the given command at some time in the future. The command - * may execute in a new thread, in a pooled thread, or in the calling - * thread, at the discretion of the Executor implementation. - * - * @param command the runnable task - * @throws RejectedExecutionException if this task cannot be - * accepted for execution. - * @throws NullPointerException if command is null - */ - public void execute(Runnable command) - { - executorService_.execute(command); - } - - /** - * 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. - * - *

This method does not wait for previously submitted tasks to - * complete execution. Use {@link #awaitTermination awaitTermination} - * to do that. - * - * @throws SecurityException if a security manager exists and - * shutting down this ExecutorService may manipulate - * threads that the caller is not permitted to modify - * because it does not hold {@link - * java.lang.RuntimePermission}("modifyThread"), - * or the security manager's checkAccess method - * denies access. - */ - public void shutdown() - { - /* This is a noop. */ - } - - /** - * Attempts to stop all actively executing tasks, halts the - * processing of waiting tasks, and returns a list of the tasks - * that were awaiting execution. - * - *

This method does not wait for actively executing tasks to - * terminate. Use {@link #awaitTermination awaitTermination} to - * do that. - * - *

There are no guarantees beyond best-effort attempts to stop - * processing actively executing tasks. For example, typical - * implementations will cancel via {@link Thread#interrupt}, so any - * task that fails to respond to interrupts may never terminate. - * - * @return list of tasks that never commenced execution - * @throws SecurityException if a security manager exists and - * shutting down this ExecutorService may manipulate - * threads that the caller is not permitted to modify - * because it does not hold {@link - * java.lang.RuntimePermission}("modifyThread"), - * or the security manager's checkAccess method - * denies access. - */ - public List shutdownNow() - { - return executorService_.shutdownNow(); - } - - /** - * Returns true if this executor has been shut down. - * - * @return true if this executor has been shut down - */ - public boolean isShutdown() - { - return executorService_.isShutdown(); - } - - /** - * Returns true if all tasks have completed following shut down. - * Note that isTerminated is never true unless - * either shutdown or shutdownNow was called first. - * - * @return true if all tasks have completed following shut down - */ - public boolean isTerminated() - { - return executorService_.isTerminated(); - } - - /** - * 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 true if this executor terminated and - * false if the timeout elapsed before termination - * @throws InterruptedException if interrupted while waiting - */ - public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException - { - return executorService_.awaitTermination(timeout, unit); - } - - /** - * Submits a value-returning task for execution and returns a - * Future representing the pending results of the task. The - * Future's get method will return the task's result upon - * successful completion. - * - *

- * If you would like to immediately block waiting - * for a task, you can use constructions of the form - * result = exec.submit(aCallable).get(); - * - *

Note: The {@link Executors} class includes a set of methods - * that can convert some other common closure-like objects, - * for example, {@link java.security.PrivilegedAction} to - * {@link Callable} form so they can be submitted. - * - * @param task the task to submit - * @return a Future representing pending completion of the task - * @throws RejectedExecutionException if the task cannot be - * scheduled for execution - * @throws NullPointerException if the task is null - */ - public Future submit(Callable task) - { - return executorService_.submit(task); - } - - /** - * Submits a Runnable task for execution and returns a Future - * representing that task. The Future's get method will - * return the given result upon successful completion. - * - * @param task the task to submit - * @param result the result to return - * @return a Future representing pending completion of the task - * @throws RejectedExecutionException if the task cannot be - * scheduled for execution - * @throws NullPointerException if the task is null - */ - public Future submit(Runnable task, T result) - { - return executorService_.submit(task, result); - } - - /** - * Submits a Runnable task for execution and returns a Future - * representing that task. The Future's get method will - * return null upon successful completion. - * - * @param task the task to submit - * @return a Future representing pending completion of the task - * @throws RejectedExecutionException if the task cannot be - * scheduled for execution - * @throws NullPointerException if the task is null - */ - public Future submit(Runnable task) - { - return executorService_.submit(task); - } - - /** - * Executes the given tasks, returning a list of Futures holding - * their status and results when all complete. - * {@link Future#isDone} is true for each - * element of the returned list. - * Note that a completed task could have - * terminated either normally or by throwing an exception. - * The results of this method are undefined if the given - * collection is modified while this operation is in progress. - * - * @param tasks the collection of tasks - * @return A list of Futures representing the tasks, in the same - * sequential order as produced by the iterator for the - * given task list, each of which has completed. - * @throws InterruptedException if interrupted while waiting, in - * which case unfinished tasks are cancelled. - * @throws NullPointerException if tasks or any of its elements are null - * @throws RejectedExecutionException if any task cannot be - * scheduled for execution - */ - - public List> invokeAll(Collection> tasks) throws InterruptedException - { - return executorService_.invokeAll(tasks); - } - - /** - * Executes the given tasks, returning a list of Futures holding - * their status and results - * when all complete or the timeout expires, whichever happens first. - * {@link Future#isDone} is true for each - * element of the returned list. - * Upon return, tasks that have not completed are cancelled. - * Note that a completed task could have - * terminated either normally or by throwing an exception. - * The results of this method are undefined if the given - * collection is modified while this operation is in progress. - * - * @param tasks the collection of tasks - * @param timeout the maximum time to wait - * @param unit the time unit of the timeout argument - * @return a list of Futures representing the tasks, in the same - * sequential order as produced by the iterator for the - * given task list. If the operation did not time out, - * each task will have completed. If it did time out, some - * of these tasks will not have completed. - * @throws InterruptedException if interrupted while waiting, in - * which case unfinished tasks are cancelled - * @throws NullPointerException if tasks, any of its elements, or - * unit are null - * @throws RejectedExecutionException if any task cannot be scheduled - * for execution - */ - public List> invokeAll(Collection> tasks, long timeout, TimeUnit unit) throws InterruptedException - { - return executorService_.invokeAll(tasks, timeout, unit); - } - - /** - * Executes the given tasks, returning the result - * of one that has completed successfully (i.e., without throwing - * an exception), if any do. Upon normal or exceptional return, - * tasks that have not completed are cancelled. - * The results of this method are undefined if the given - * collection is modified while this operation is in progress. - * - * @param tasks the collection of tasks - * @return the result returned by one of the tasks - * @throws InterruptedException if interrupted while waiting - * @throws NullPointerException if tasks or any of its elements - * are null - * @throws IllegalArgumentException if tasks is empty - * @throws ExecutionException if no task successfully completes - * @throws RejectedExecutionException if tasks cannot be scheduled - * for execution - */ - public T invokeAny(Collection> tasks) throws InterruptedException, ExecutionException - { - return executorService_.invokeAny(tasks); - } - - /** - * Executes the given tasks, returning the result - * of one that has completed successfully (i.e., without throwing - * an exception), if any do before the given timeout elapses. - * Upon normal or exceptional return, tasks that have not - * completed are cancelled. - * The results of this method are undefined if the given - * collection is modified while this operation is in progress. - * - * @param tasks the collection of tasks - * @param timeout the maximum time to wait - * @param unit the time unit of the timeout argument - * @return the result returned by one of the tasks. - * @throws InterruptedException if interrupted while waiting - * @throws NullPointerException if tasks, any of its elements, or - * unit are null - * @throws TimeoutException if the given timeout elapses before - * any task successfully completes - * @throws ExecutionException if no task successfully completes - * @throws RejectedExecutionException if tasks cannot be scheduled - * for execution - */ - public T invokeAny(Collection> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - { - return executorService_.invokeAny(tasks, timeout, unit); - } -} +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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.apache.cassandra.concurrent; + +import java.util.Collection; +import java.util.List; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.RejectedExecutionException; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +public class AIOExecutorService implements ExecutorService +{ + private ExecutorService executorService_; + + public AIOExecutorService(int corePoolSize, + int maximumPoolSize, + long keepAliveTime, + TimeUnit unit, + BlockingQueue workQueue, + ThreadFactory threadFactory) + { + executorService_ = new ThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory); + } + + /** + * Executes the given command at some time in the future. The command + * may execute in a new thread, in a pooled thread, or in the calling + * thread, at the discretion of the Executor implementation. + * + * @param command the runnable task + * @throws RejectedExecutionException if this task cannot be + * accepted for execution. + * @throws NullPointerException if command is null + */ + public void execute(Runnable command) + { + executorService_.execute(command); + } + + /** + * 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. + * + *

This method does not wait for previously submitted tasks to + * complete execution. Use {@link #awaitTermination awaitTermination} + * to do that. + * + * @throws SecurityException if a security manager exists and + * shutting down this ExecutorService may manipulate + * threads that the caller is not permitted to modify + * because it does not hold {@link + * java.lang.RuntimePermission}("modifyThread"), + * or the security manager's checkAccess method + * denies access. + */ + public void shutdown() + { + /* This is a noop. */ + } + + /** + * Attempts to stop all actively executing tasks, halts the + * processing of waiting tasks, and returns a list of the tasks + * that were awaiting execution. + * + *

This method does not wait for actively executing tasks to + * terminate. Use {@link #awaitTermination awaitTermination} to + * do that. + * + *

There are no guarantees beyond best-effort attempts to stop + * processing actively executing tasks. For example, typical + * implementations will cancel via {@link Thread#interrupt}, so any + * task that fails to respond to interrupts may never terminate. + * + * @return list of tasks that never commenced execution + * @throws SecurityException if a security manager exists and + * shutting down this ExecutorService may manipulate + * threads that the caller is not permitted to modify + * because it does not hold {@link + * java.lang.RuntimePermission}("modifyThread"), + * or the security manager's checkAccess method + * denies access. + */ + public List shutdownNow() + { + return executorService_.shutdownNow(); + } + + /** + * Returns true if this executor has been shut down. + * + * @return true if this executor has been shut down + */ + public boolean isShutdown() + { + return executorService_.isShutdown(); + } + + /** + * Returns true if all tasks have completed following shut down. + * Note that isTerminated is never true unless + * either shutdown or shutdownNow was called first. + * + * @return true if all tasks have completed following shut down + */ + public boolean isTerminated() + { + return executorService_.isTerminated(); + } + + /** + * 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 true if this executor terminated and + * false if the timeout elapsed before termination + * @throws InterruptedException if interrupted while waiting + */ + public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException + { + return executorService_.awaitTermination(timeout, unit); + } + + /** + * Submits a value-returning task for execution and returns a + * Future representing the pending results of the task. The + * Future's get method will return the task's result upon + * successful completion. + * + *

+ * If you would like to immediately block waiting + * for a task, you can use constructions of the form + * result = exec.submit(aCallable).get(); + * + *

Note: The {@link Executors} class includes a set of methods + * that can convert some other common closure-like objects, + * for example, {@link java.security.PrivilegedAction} to + * {@link Callable} form so they can be submitted. + * + * @param task the task to submit + * @return a Future representing pending completion of the task + * @throws RejectedExecutionException if the task cannot be + * scheduled for execution + * @throws NullPointerException if the task is null + */ + public Future submit(Callable task) + { + return executorService_.submit(task); + } + + /** + * Submits a Runnable task for execution and returns a Future + * representing that task. The Future's get method will + * return the given result upon successful completion. + * + * @param task the task to submit + * @param result the result to return + * @return a Future representing pending completion of the task + * @throws RejectedExecutionException if the task cannot be + * scheduled for execution + * @throws NullPointerException if the task is null + */ + public Future submit(Runnable task, T result) + { + return executorService_.submit(task, result); + } + + /** + * Submits a Runnable task for execution and returns a Future + * representing that task. The Future's get method will + * return null upon successful completion. + * + * @param task the task to submit + * @return a Future representing pending completion of the task + * @throws RejectedExecutionException if the task cannot be + * scheduled for execution + * @throws NullPointerException if the task is null + */ + public Future submit(Runnable task) + { + return executorService_.submit(task); + } + + /** + * Executes the given tasks, returning a list of Futures holding + * their status and results when all complete. + * {@link Future#isDone} is true for each + * element of the returned list. + * Note that a completed task could have + * terminated either normally or by throwing an exception. + * The results of this method are undefined if the given + * collection is modified while this operation is in progress. + * + * @param tasks the collection of tasks + * @return A list of Futures representing the tasks, in the same + * sequential order as produced by the iterator for the + * given task list, each of which has completed. + * @throws InterruptedException if interrupted while waiting, in + * which case unfinished tasks are cancelled. + * @throws NullPointerException if tasks or any of its elements are null + * @throws RejectedExecutionException if any task cannot be + * scheduled for execution + */ + + public List> invokeAll(Collection> tasks) throws InterruptedException + { + return executorService_.invokeAll(tasks); + } + + /** + * Executes the given tasks, returning a list of Futures holding + * their status and results + * when all complete or the timeout expires, whichever happens first. + * {@link Future#isDone} is true for each + * element of the returned list. + * Upon return, tasks that have not completed are cancelled. + * Note that a completed task could have + * terminated either normally or by throwing an exception. + * The results of this method are undefined if the given + * collection is modified while this operation is in progress. + * + * @param tasks the collection of tasks + * @param timeout the maximum time to wait + * @param unit the time unit of the timeout argument + * @return a list of Futures representing the tasks, in the same + * sequential order as produced by the iterator for the + * given task list. If the operation did not time out, + * each task will have completed. If it did time out, some + * of these tasks will not have completed. + * @throws InterruptedException if interrupted while waiting, in + * which case unfinished tasks are cancelled + * @throws NullPointerException if tasks, any of its elements, or + * unit are null + * @throws RejectedExecutionException if any task cannot be scheduled + * for execution + */ + public List> invokeAll(Collection> tasks, long timeout, TimeUnit unit) throws InterruptedException + { + return executorService_.invokeAll(tasks, timeout, unit); + } + + /** + * Executes the given tasks, returning the result + * of one that has completed successfully (i.e., without throwing + * an exception), if any do. Upon normal or exceptional return, + * tasks that have not completed are cancelled. + * The results of this method are undefined if the given + * collection is modified while this operation is in progress. + * + * @param tasks the collection of tasks + * @return the result returned by one of the tasks + * @throws InterruptedException if interrupted while waiting + * @throws NullPointerException if tasks or any of its elements + * are null + * @throws IllegalArgumentException if tasks is empty + * @throws ExecutionException if no task successfully completes + * @throws RejectedExecutionException if tasks cannot be scheduled + * for execution + */ + public T invokeAny(Collection> tasks) throws InterruptedException, ExecutionException + { + return executorService_.invokeAny(tasks); + } + + /** + * Executes the given tasks, returning the result + * of one that has completed successfully (i.e., without throwing + * an exception), if any do before the given timeout elapses. + * Upon normal or exceptional return, tasks that have not + * completed are cancelled. + * The results of this method are undefined if the given + * collection is modified while this operation is in progress. + * + * @param tasks the collection of tasks + * @param timeout the maximum time to wait + * @param unit the time unit of the timeout argument + * @return the result returned by one of the tasks. + * @throws InterruptedException if interrupted while waiting + * @throws NullPointerException if tasks, any of its elements, or + * unit are null + * @throws TimeoutException if the given timeout elapses before + * any task successfully completes + * @throws ExecutionException if no task successfully completes + * @throws RejectedExecutionException if tasks cannot be scheduled + * for execution + */ + public T invokeAny(Collection> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException + { + return executorService_.invokeAny(tasks, timeout, unit); + } +} Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/Context.java URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/Context.java?rev=799331&r1=799330&r2=799331&view=diff ============================================================================== --- incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/Context.java (original) +++ incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/Context.java Thu Jul 30 15:30:21 2009 @@ -1,52 +1,52 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF 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.apache.cassandra.concurrent; - -import java.util.HashMap; -import java.util.Map; - -/** - * Context object adding a collection of key/value pairs into ThreadLocalContext. - * Author : Avinash Lakshman ( alakshman@facebook.com) & Prashant Malik ( pmalik@facebook.com ) - */ - -public class Context -{ - private Map ht_; - - public Context() - { - ht_ = new HashMap(); - } - - public Object put(Object key, Object value) - { - return ht_.put(key, value); - } - - public Object get(Object key) - { - return ht_.get(key); - } - - public void remove(Object key) - { - ht_.remove(key); - } -} +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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.apache.cassandra.concurrent; + +import java.util.HashMap; +import java.util.Map; + +/** + * Context object adding a collection of key/value pairs into ThreadLocalContext. + * Author : Avinash Lakshman ( alakshman@facebook.com) & Prashant Malik ( pmalik@facebook.com ) + */ + +public class Context +{ + private Map ht_; + + public Context() + { + ht_ = new HashMap(); + } + + public Object put(Object key, Object value) + { + return ht_.put(key, value); + } + + public Object get(Object key) + { + return ht_.get(key); + } + + public void remove(Object key) + { + ht_.remove(key); + } +} Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/ContinuationContext.java URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/ContinuationContext.java?rev=799331&r1=799330&r2=799331&view=diff ============================================================================== --- incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/ContinuationContext.java (original) +++ incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/ContinuationContext.java Thu Jul 30 15:30:21 2009 @@ -1,52 +1,52 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF 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.apache.cassandra.concurrent; - -import org.apache.commons.javaflow.Continuation; - -public class ContinuationContext -{ - private Continuation continuation_; - private Object result_; - - public ContinuationContext(Continuation continuation) - { - continuation_ = continuation; - } - - public Continuation getContinuation() - { - return continuation_; - } - - public void setContinuation(Continuation continuation) - { - continuation_ = continuation; - } - - public Object result() - { - return result_; - } - - public void result(Object result) - { - result_ = result; - } -} +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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.apache.cassandra.concurrent; + +import org.apache.commons.javaflow.Continuation; + +public class ContinuationContext +{ + private Continuation continuation_; + private Object result_; + + public ContinuationContext(Continuation continuation) + { + continuation_ = continuation; + } + + public Continuation getContinuation() + { + return continuation_; + } + + public void setContinuation(Continuation continuation) + { + continuation_ = continuation; + } + + public Object result() + { + return result_; + } + + public void result(Object result) + { + result_ = result; + } +} Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/ContinuationStage.java URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/ContinuationStage.java?rev=799331&r1=799330&r2=799331&view=diff ============================================================================== --- incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/ContinuationStage.java (original) +++ incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/ContinuationStage.java Thu Jul 30 15:30:21 2009 @@ -1,89 +1,89 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF 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.apache.cassandra.concurrent; - -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Future; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; - - -public class ContinuationStage implements IStage -{ - private String name_; - private ContinuationsExecutor executorService_; - - public ContinuationStage(String name, int numThreads) - { - name_ = name; - executorService_ = new ContinuationsExecutor( numThreads, - numThreads, - Integer.MAX_VALUE, - TimeUnit.SECONDS, - new LinkedBlockingQueue(), - new ThreadFactoryImpl(name) - ); - } - - public String getName() - { - return name_; - } - - public ExecutorService getInternalThreadPool() - { - return executorService_; - } - - public Future execute(Callable callable) { - return executorService_.submit(callable); - } - - public void execute(Runnable runnable) { - executorService_.execute(runnable); - } - - public ScheduledFuture schedule(Runnable command, long delay, TimeUnit unit) - { - throw new UnsupportedOperationException("This operation is not supported"); - } - - public ScheduledFuture scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) { - throw new UnsupportedOperationException("This operation is not supported"); - } - - public ScheduledFuture scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) { - throw new UnsupportedOperationException("This operation is not supported"); - } - - public void shutdown() { - executorService_.shutdownNow(); - } - - public boolean isShutdown() - { - return executorService_.isShutdown(); - } - - public long getPendingTasks(){ - return (executorService_.getTaskCount() - executorService_.getCompletedTaskCount()); - } -} +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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.apache.cassandra.concurrent; + +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; + + +public class ContinuationStage implements IStage +{ + private String name_; + private ContinuationsExecutor executorService_; + + public ContinuationStage(String name, int numThreads) + { + name_ = name; + executorService_ = new ContinuationsExecutor( numThreads, + numThreads, + Integer.MAX_VALUE, + TimeUnit.SECONDS, + new LinkedBlockingQueue(), + new ThreadFactoryImpl(name) + ); + } + + public String getName() + { + return name_; + } + + public ExecutorService getInternalThreadPool() + { + return executorService_; + } + + public Future execute(Callable callable) { + return executorService_.submit(callable); + } + + public void execute(Runnable runnable) { + executorService_.execute(runnable); + } + + public ScheduledFuture schedule(Runnable command, long delay, TimeUnit unit) + { + throw new UnsupportedOperationException("This operation is not supported"); + } + + public ScheduledFuture scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) { + throw new UnsupportedOperationException("This operation is not supported"); + } + + public ScheduledFuture scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) { + throw new UnsupportedOperationException("This operation is not supported"); + } + + public void shutdown() { + executorService_.shutdownNow(); + } + + public boolean isShutdown() + { + return executorService_.isShutdown(); + } + + public long getPendingTasks(){ + return (executorService_.getTaskCount() - executorService_.getCompletedTaskCount()); + } +} Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/DebuggableScheduledThreadPoolExecutor.java URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/DebuggableScheduledThreadPoolExecutor.java?rev=799331&r1=799330&r2=799331&view=diff ============================================================================== --- incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/DebuggableScheduledThreadPoolExecutor.java (original) +++ incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/DebuggableScheduledThreadPoolExecutor.java Thu Jul 30 15:30:21 2009 @@ -1,76 +1,76 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF 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.apache.cassandra.concurrent; - -import java.util.concurrent.*; - -import org.apache.cassandra.utils.LogUtil; -import org.apache.log4j.Logger; -import org.apache.cassandra.utils.*; - -/** - * This is a wrapper class for the ScheduledThreadPoolExecutor. It provides an implementation - * for the afterExecute() found in the ThreadPoolExecutor class to log any unexpected - * Runtime Exceptions. - * - * Author : Avinash Lakshman ( alakshman@facebook.com) & Prashant Malik ( pmalik@facebook.com ) - */ -public final class DebuggableScheduledThreadPoolExecutor extends ScheduledThreadPoolExecutor -{ - private static Logger logger_ = Logger.getLogger(DebuggableScheduledThreadPoolExecutor.class); - - public DebuggableScheduledThreadPoolExecutor(int threads, - ThreadFactory threadFactory) - { - super(threads, threadFactory); - } - - /** - * (non-Javadoc) - * @see java.util.concurrent.ThreadPoolExecutor#afterExecute(java.lang.Runnable, java.lang.Throwable) - */ - public void afterExecute(Runnable r, Throwable t) - { - super.afterExecute(r,t); - if ( t != null ) - { - Context ctx = ThreadLocalContext.get(); - if ( ctx != null ) - { - Object object = ctx.get(r.getClass().getName()); - - if ( object != null ) - { - logger_.info("**** In afterExecute() " + t.getClass().getName() + " occured while working with " + object + " ****"); - } - else - { - logger_.info("**** In afterExecute() " + t.getClass().getName() + " occured ****"); - } - } - - Throwable cause = t.getCause(); - if ( cause != null ) - { - logger_.info( LogUtil.throwableToString(cause) ); - } - logger_.info( LogUtil.throwableToString(t) ); - } - } -} +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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.apache.cassandra.concurrent; + +import java.util.concurrent.*; + +import org.apache.cassandra.utils.LogUtil; +import org.apache.log4j.Logger; +import org.apache.cassandra.utils.*; + +/** + * This is a wrapper class for the ScheduledThreadPoolExecutor. It provides an implementation + * for the afterExecute() found in the ThreadPoolExecutor class to log any unexpected + * Runtime Exceptions. + * + * Author : Avinash Lakshman ( alakshman@facebook.com) & Prashant Malik ( pmalik@facebook.com ) + */ +public final class DebuggableScheduledThreadPoolExecutor extends ScheduledThreadPoolExecutor +{ + private static Logger logger_ = Logger.getLogger(DebuggableScheduledThreadPoolExecutor.class); + + public DebuggableScheduledThreadPoolExecutor(int threads, + ThreadFactory threadFactory) + { + super(threads, threadFactory); + } + + /** + * (non-Javadoc) + * @see java.util.concurrent.ThreadPoolExecutor#afterExecute(java.lang.Runnable, java.lang.Throwable) + */ + public void afterExecute(Runnable r, Throwable t) + { + super.afterExecute(r,t); + if ( t != null ) + { + Context ctx = ThreadLocalContext.get(); + if ( ctx != null ) + { + Object object = ctx.get(r.getClass().getName()); + + if ( object != null ) + { + logger_.info("**** In afterExecute() " + t.getClass().getName() + " occured while working with " + object + " ****"); + } + else + { + logger_.info("**** In afterExecute() " + t.getClass().getName() + " occured ****"); + } + } + + Throwable cause = t.getCause(); + if ( cause != null ) + { + logger_.info( LogUtil.throwableToString(cause) ); + } + logger_.info( LogUtil.throwableToString(t) ); + } + } +}