[1/2] git commit: license headers

2014-02-15 Thread randgalt
Repository: curator
Updated Branches:
  refs/heads/CURATOR-88 2b2e78582 - 95b8e77e9


license headers


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/9d34d3d8
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/9d34d3d8
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/9d34d3d8

Branch: refs/heads/CURATOR-88
Commit: 9d34d3d8295a31e4fcd2dbfab9db72c3f9516b85
Parents: 2b2e785
Author: randgalt randg...@apache.org
Authored: Sat Feb 15 11:49:10 2014 -0500
Committer: randgalt randg...@apache.org
Committed: Sat Feb 15 11:49:10 2014 -0500

--
 .../apache/curator/x/rest/CuratorRestClasses.java | 18 ++
 .../apache/curator/x/rest/CuratorRestContext.java | 18 ++
 .../apache/curator/x/rest/api/ClientResource.java | 18 ++
 .../org/apache/curator/x/rest/api/Constants.java  | 18 ++
 .../apache/curator/x/rest/api/LeaderResource.java | 18 ++
 .../apache/curator/x/rest/api/LockResource.java   | 18 ++
 .../curator/x/rest/api/NodeCacheResource.java | 18 ++
 .../x/rest/api/PathChildrenCacheResource.java | 18 ++
 .../rest/api/PersistentEphemeralNodeResource.java | 18 ++
 .../curator/x/rest/api/ReadWriteLockResource.java | 18 ++
 .../x/rest/api/RestBackgroundCallback.java| 18 ++
 .../apache/curator/x/rest/api/RestWatcher.java| 18 ++
 .../curator/x/rest/api/SemaphoreResource.java | 18 ++
 .../curator/x/rest/api/SessionResource.java   | 18 ++
 .../org/apache/curator/x/rest/details/Closer.java | 18 ++
 .../apache/curator/x/rest/details/Session.java| 18 ++
 .../curator/x/rest/details/SessionManager.java| 18 ++
 .../curator/x/rest/entities/CreateSpec.java   | 18 ++
 .../curator/x/rest/entities/DeleteSpec.java   | 18 ++
 .../curator/x/rest/entities/ExistsSpec.java   | 18 ++
 .../curator/x/rest/entities/GetChildrenSpec.java  | 18 ++
 .../curator/x/rest/entities/GetDataSpec.java  | 18 ++
 .../curator/x/rest/entities/LeaderSpec.java   | 18 ++
 .../apache/curator/x/rest/entities/LockSpec.java  | 18 ++
 .../curator/x/rest/entities/NodeCacheSpec.java| 18 ++
 .../apache/curator/x/rest/entities/NodeData.java  | 18 ++
 .../x/rest/entities/PathChildrenCacheSpec.java| 18 ++
 .../entities/PersistentEphemeralNodeSpec.java | 18 ++
 .../curator/x/rest/entities/SemaphoreSpec.java| 18 ++
 .../curator/x/rest/entities/SetDataSpec.java  | 18 ++
 .../curator/x/rest/entities/StatusMessage.java| 18 ++
 31 files changed, 558 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/curator/blob/9d34d3d8/curator-x-rest/src/main/java/org/apache/curator/x/rest/CuratorRestClasses.java
--
diff --git 
a/curator-x-rest/src/main/java/org/apache/curator/x/rest/CuratorRestClasses.java
 
b/curator-x-rest/src/main/java/org/apache/curator/x/rest/CuratorRestClasses.java
index 5b56b46..768b649 100644
--- 
a/curator-x-rest/src/main/java/org/apache/curator/x/rest/CuratorRestClasses.java
+++ 
b/curator-x-rest/src/main/java/org/apache/curator/x/rest/CuratorRestClasses.java
@@ -1,3 +1,21 @@
+/**
+ * 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.curator.x.rest;
 
 import com.google.common.collect.ImmutableList;

http://git-wip-us.apache.org/repos/asf/curator/blob/9d34d3d8/curator-x-rest/src/main/java/org/apache/curator/x/rest/CuratorRestContext.java
--
diff --git 
a/curator-x-rest/src/main/java/org/apache/curator/x/rest/CuratorRestContext.java
 

git commit: expiration should now be on a pre-object basis

2014-02-15 Thread randgalt
Repository: curator
Updated Branches:
  refs/heads/CURATOR-88 8f6edd706 - ce456d2df


expiration should now be on a pre-object basis


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/ce456d2d
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/ce456d2d
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/ce456d2d

Branch: refs/heads/CURATOR-88
Commit: ce456d2df24c9c64108d1c40e111b66a7e00e3ca
Parents: 8f6edd7
Author: randgalt randg...@apache.org
Authored: Sat Feb 15 19:39:38 2014 -0500
Committer: randgalt randg...@apache.org
Committed: Sat Feb 15 19:39:38 2014 -0500

--
 .../curator/x/rest/CuratorRestContext.java  | 38 +-
 .../curator/x/rest/api/ClientResource.java  | 24 -
 .../apache/curator/x/rest/api/Constants.java|  2 +-
 .../org/apache/curator/x/rest/api/Session.java  | 55 +---
 4 files changed, 50 insertions(+), 69 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/curator/blob/ce456d2d/curator-x-rest/src/main/java/org/apache/curator/x/rest/CuratorRestContext.java
--
diff --git 
a/curator-x-rest/src/main/java/org/apache/curator/x/rest/CuratorRestContext.java
 
b/curator-x-rest/src/main/java/org/apache/curator/x/rest/CuratorRestContext.java
index cca2e89..a07197e 100644
--- 
a/curator-x-rest/src/main/java/org/apache/curator/x/rest/CuratorRestContext.java
+++ 
b/curator-x-rest/src/main/java/org/apache/curator/x/rest/CuratorRestContext.java
@@ -20,14 +20,10 @@ package org.apache.curator.x.rest;
 
 import com.google.common.base.Preconditions;
 import org.apache.curator.framework.CuratorFramework;
-import org.apache.curator.framework.state.ConnectionState;
-import org.apache.curator.framework.state.ConnectionStateListener;
 import org.apache.curator.utils.ThreadUtils;
 import org.apache.curator.x.rest.api.Session;
 import org.codehaus.jackson.map.ObjectMapper;
 import org.codehaus.jackson.map.ObjectWriter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import java.io.Closeable;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
@@ -35,7 +31,6 @@ import java.util.concurrent.atomic.AtomicReference;
 
 public class CuratorRestContext implements Closeable
 {
-private final Logger log = LoggerFactory.getLogger(getClass());
 private final Session session = new Session();
 private final ObjectMapper mapper = new ObjectMapper();
 private final ObjectWriter writer = mapper.writer();
@@ -43,17 +38,6 @@ public class CuratorRestContext implements Closeable
 private final int sessionLengthMs;
 private final AtomicReferenceState state = new 
AtomicReferenceState(State.LATENT);
 private final ScheduledExecutorService executorService = 
ThreadUtils.newSingleThreadScheduledExecutor(CuratorRestContext);
-private final ConnectionStateListener connectionStateListener = new 
ConnectionStateListener()
-{
-@Override
-public void stateChanged(CuratorFramework client, ConnectionState 
newState)
-{
-if ( newState == ConnectionState.LOST )
-{
-handleLostConnection();
-}
-}
-};
 
 private enum State
 {
@@ -77,7 +61,6 @@ public class CuratorRestContext implements Closeable
 public Session getSession()
 {
 Preconditions.checkState(state.get() == State.STARTED, Not started);
-session.updateLastUse();
 return session;
 }
 
@@ -85,35 +68,22 @@ public class CuratorRestContext implements Closeable
 {
 Preconditions.checkState(state.compareAndSet(State.LATENT, 
State.STARTED), Already started);
 
-
client.getConnectionStateListenable().addListener(connectionStateListener);
-
 Runnable runner = new Runnable()
 {
 @Override
 public void run()
 {
-checkSession();
+session.checkExpiredThings(sessionLengthMs);
 }
 };
 executorService.scheduleAtFixedRate(runner, sessionLengthMs, 
sessionLengthMs, TimeUnit.MILLISECONDS);
 }
 
-private void checkSession()
-{
-long elapsedSinceLastUse = System.currentTimeMillis() - 
session.getLastUseMs();
-if ( elapsedSinceLastUse  sessionLengthMs )
-{
-log.warn(Session has expired. Closing all open recipes. 
Milliseconds since last ping:  + elapsedSinceLastUse);
-session.closeThings();
-}
-}
-
 @Override
 public void close()
 {
 if ( state.compareAndSet(State.STARTED, State.CLOSED) )
 {
-
client.getConnectionStateListenable().removeListener(connectionStateListener);
 executorService.shutdownNow();