accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject svn commit: r1478123 - in /accumulo/branches/1.5: core/src/main/java/org/apache/accumulo/core/client/impl/ start/src/main/java/org/apache/accumulo/start/classloader/vfs/
Date Wed, 01 May 2013 17:59:30 GMT
Author: vines
Date: Wed May  1 17:59:29 2013
New Revision: 1478123

URL: http://svn.apache.org/r1478123
Log:
ACCUMULO-1321 - Introducing VFS with a finally method to close the filesystem. Improvement
from the last hack, still not 100% content with it though


Added:
    accumulo/branches/1.5/start/src/main/java/org/apache/accumulo/start/classloader/vfs/FinalCloseDefaultFileSystemManager.java
  (with props)
Modified:
    accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/impl/MetadataLocationObtainer.java
    accumulo/branches/1.5/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java

Modified: accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/impl/MetadataLocationObtainer.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/impl/MetadataLocationObtainer.java?rev=1478123&r1=1478122&r2=1478123&view=diff
==============================================================================
--- accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/impl/MetadataLocationObtainer.java
(original)
+++ accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/impl/MetadataLocationObtainer.java
Wed May  1 17:59:29 2013
@@ -71,12 +71,12 @@ public class MetadataLocationObtainer im
   }
   
   @Override
-  public TabletLocations lookupTablet(TabletLocation src, Text row, Text stopRow, TabletLocator
parent, TCredentials credentials) throws AccumuloSecurityException,
-      AccumuloException {
-
+  public TabletLocations lookupTablet(TabletLocation src, Text row, Text stopRow, TabletLocator
parent, TCredentials credentials)
+      throws AccumuloSecurityException, AccumuloException {
+    
     try {
       ArrayList<TabletLocation> list = new ArrayList<TabletLocation>();
-
+      
       OpTimer opTimer = null;
       if (log.isTraceEnabled())
         opTimer = new OpTimer(log, Level.TRACE).start("Looking up in " + src.tablet_extent.getTableId()
+ " row=" + TextUtil.truncate(row) + "  extent="
@@ -95,9 +95,9 @@ public class MetadataLocationObtainer im
       
       boolean more = ThriftScanner.getBatchFromServer(credentials, range, src.tablet_extent,
src.tablet_location, encodedResults, locCols,
           serverSideIteratorList, serverSideIteratorOptions, Constants.SCAN_BATCH_SIZE, Constants.NO_AUTHS,
false, instance.getConfiguration());
-
+      
       decodeRows(encodedResults, results);
-
+      
       if (more && results.size() == 1) {
         range = new Range(results.lastKey().followingKey(PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME),
true, new Key(stopRow).followingKey(PartialKey.ROW), false);
         encodedResults.clear();
@@ -119,7 +119,7 @@ public class MetadataLocationObtainer im
       }
       
       return new TabletLocations(list, metadata.getSecond());
-
+      
     } catch (AccumuloServerException ase) {
       if (log.isTraceEnabled())
         log.trace(src.tablet_extent.getTableId() + " lookup failed, " + src.tablet_location
+ " server side exception");
@@ -136,7 +136,7 @@ public class MetadataLocationObtainer im
     
     return null;
   }
-
+  
   private void decodeRows(TreeMap<Key,Value> encodedResults, TreeMap<Key,Value>
results) throws AccumuloException {
     for (Entry<Key,Value> entry : encodedResults.entrySet()) {
       try {
@@ -193,7 +193,7 @@ public class MetadataLocationObtainer im
       log.trace("lookupTablets failed server=" + tserver, e);
       throw e;
     }
-
+    
     SortedMap<KeyExtent,Text> metadata = MetadataTable.getMetadataLocationEntries(results).getFirst();
     
     for (Entry<KeyExtent,Text> entry : metadata.entrySet()) {

Modified: accumulo/branches/1.5/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java?rev=1478123&r1=1478122&r2=1478123&view=diff
==============================================================================
--- accumulo/branches/1.5/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java
(original)
+++ accumulo/branches/1.5/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java
Wed May  1 17:59:29 2013
@@ -222,8 +222,8 @@ public class AccumuloVFSClassLoader {
     return localLoader.getClassLoader();
   }
   
-  public static DefaultFileSystemManager generateVfs(boolean reloading) throws FileSystemException
{
-    DefaultFileSystemManager vfs = new DefaultFileSystemManager();
+  public static FinalCloseDefaultFileSystemManager generateVfs(boolean reloading) throws
FileSystemException {
+    FinalCloseDefaultFileSystemManager vfs = new FinalCloseDefaultFileSystemManager();
     vfs.addProvider("res", new org.apache.commons.vfs2.provider.res.ResourceFileProvider());
     vfs.addProvider("zip", new org.apache.commons.vfs2.provider.zip.ZipFileProvider());
     vfs.addProvider("gz", new org.apache.commons.vfs2.provider.gzip.GzipFileProvider());

Added: accumulo/branches/1.5/start/src/main/java/org/apache/accumulo/start/classloader/vfs/FinalCloseDefaultFileSystemManager.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/start/src/main/java/org/apache/accumulo/start/classloader/vfs/FinalCloseDefaultFileSystemManager.java?rev=1478123&view=auto
==============================================================================
--- accumulo/branches/1.5/start/src/main/java/org/apache/accumulo/start/classloader/vfs/FinalCloseDefaultFileSystemManager.java
(added)
+++ accumulo/branches/1.5/start/src/main/java/org/apache/accumulo/start/classloader/vfs/FinalCloseDefaultFileSystemManager.java
Wed May  1 17:59:29 2013
@@ -0,0 +1,25 @@
+/*
+ * 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.accumulo.start.classloader.vfs;
+
+import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
+
+public class FinalCloseDefaultFileSystemManager extends DefaultFileSystemManager {
+  public void finalize() {
+    close();
+  }
+}

Propchange: accumulo/branches/1.5/start/src/main/java/org/apache/accumulo/start/classloader/vfs/FinalCloseDefaultFileSystemManager.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message