chukwa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asrab...@apache.org
Subject svn commit: r783225 - in /hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa: datacollection/adaptor/AbstractAdaptor.java datacollection/agent/AdaptorManager.java util/ConstRateAdaptor.java util/MaxRateSender.java
Date Wed, 10 Jun 2009 06:41:44 GMT
Author: asrabkin
Date: Wed Jun 10 06:41:43 2009
New Revision: 783225

URL: http://svn.apache.org/viewvc?rev=783225&view=rev
Log:
CHUKWA-268.  Some missing files from prev. patch

Added:
    hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/adaptor/AbstractAdaptor.java
    hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/agent/AdaptorManager.java
Modified:
    hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/ConstRateAdaptor.java
    hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/MaxRateSender.java

Added: hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/adaptor/AbstractAdaptor.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/adaptor/AbstractAdaptor.java?rev=783225&view=auto
==============================================================================
--- hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/adaptor/AbstractAdaptor.java
(added)
+++ hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/adaptor/AbstractAdaptor.java
Wed Jun 10 06:41:43 2009
@@ -0,0 +1,51 @@
+/*
+ * 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.hadoop.chukwa.datacollection.adaptor;
+
+import org.apache.hadoop.chukwa.datacollection.ChunkReceiver;
+import org.apache.hadoop.chukwa.datacollection.agent.AdaptorManager;
+
+public abstract class AbstractAdaptor implements Adaptor {
+  
+
+  protected String type;
+  protected ChunkReceiver dest;
+  protected long adaptorID;
+  protected AdaptorManager control;
+
+  @Override
+  public final String getType() {
+    return type;
+  }
+
+  @Override
+  public final void start(long adaptorID, String type, String status, long offset,
+      ChunkReceiver dest, AdaptorManager c) throws AdaptorException {
+    this.adaptorID = adaptorID;
+    this.type = type;
+    this.dest=dest;
+    start(status, offset);
+    control = c;
+  }
+  
+  public abstract void start(String status, long offset) throws AdaptorException;
+
+  public void deregisterAndStop(boolean gracefully) {
+    control.stopAdaptor(adaptorID, gracefully);
+  }
+}

Added: hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/agent/AdaptorManager.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/agent/AdaptorManager.java?rev=783225&view=auto
==============================================================================
--- hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/agent/AdaptorManager.java
(added)
+++ hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/agent/AdaptorManager.java
Wed Jun 10 06:41:43 2009
@@ -0,0 +1,37 @@
+/*
+ * 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.hadoop.chukwa.datacollection.agent;
+
+import java.util.Map;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.chukwa.datacollection.adaptor.Adaptor;
+
+/**
+ * The interface to the agent that is exposed to adaptors.
+ *
+ */
+public interface AdaptorManager {
+  
+  Configuration getConfiguration();
+  int adaptorCount();
+  long stopAdaptor(long number, boolean gracefully);
+  Adaptor getAdaptor(long id);
+  long processAddCommand(String cmd);
+  Map<Long, String> getAdaptorList();
+
+}

Modified: hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/ConstRateAdaptor.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/ConstRateAdaptor.java?rev=783225&r1=783224&r2=783225&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/ConstRateAdaptor.java (original)
+++ hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/ConstRateAdaptor.java Wed Jun
10 06:41:43 2009
@@ -24,6 +24,7 @@
 import org.apache.hadoop.chukwa.datacollection.*;
 import org.apache.hadoop.chukwa.datacollection.adaptor.Adaptor;
 import org.apache.hadoop.chukwa.datacollection.adaptor.AdaptorException;
+import org.apache.hadoop.chukwa.datacollection.agent.AdaptorManager;
 
 public class ConstRateAdaptor extends Thread implements Adaptor {
 
@@ -43,7 +44,7 @@
   }
 
   public void start(long adaptor, String type, String bytesPerSecParam,
-      long offset, ChunkReceiver dest) throws AdaptorException {
+      long offset, ChunkReceiver dest, AdaptorManager c) throws AdaptorException {
     try {
       bytesPerSec = Integer.parseInt(bytesPerSecParam.trim());
     } catch (NumberFormatException e) {

Modified: hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/MaxRateSender.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/MaxRateSender.java?rev=783225&r1=783224&r2=783225&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/MaxRateSender.java (original)
+++ hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/util/MaxRateSender.java Wed Jun
10 06:41:43 2009
@@ -22,6 +22,7 @@
 import java.util.Random;
 import org.apache.hadoop.chukwa.ChunkImpl;
 import org.apache.hadoop.chukwa.datacollection.*;
+import org.apache.hadoop.chukwa.datacollection.agent.AdaptorManager;
 import org.apache.hadoop.chukwa.datacollection.adaptor.Adaptor;
 import org.apache.hadoop.chukwa.datacollection.adaptor.AdaptorException;
 
@@ -41,7 +42,7 @@
   }
 
   public void start(long adaptor, String type, String status, long offset,
-      ChunkReceiver dest) throws AdaptorException {
+      ChunkReceiver dest, AdaptorManager c) throws AdaptorException {
     this.setName("MaxRateSender adaptor");
     this.adaptorID = adaptor;
     this.offset = offset;



Mime
View raw message