Updated Branches: refs/heads/master d0d535c7d -> 99218cd23
Changing license header to Apache for blur-thrift and blur-util. Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/99218cd2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/99218cd2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/99218cd2 Branch: refs/heads/master Commit: 99218cd23aa987f06a87b7ffc1240d45bb2e484e Parents: 4b32c8e Author: Aaron McCurry <[email protected]> Authored: Sun Sep 2 22:23:53 2012 -0400 Committer: Aaron McCurry <[email protected]> Committed: Sun Sep 2 22:23:53 2012 -0400 ---------------------------------------------------------------------- src/blur-thrift/pom.xml | 19 +++++++++ .../nearinfinity/blur/thrift/AbstractCommand.java | 32 +++++++------- .../nearinfinity/blur/thrift/AsyncClientPool.java | 28 ++++++------ .../com/nearinfinity/blur/thrift/BException.java | 16 +++++++ .../com/nearinfinity/blur/thrift/BlurClient.java | 20 ++++++++- .../blur/thrift/BlurClientManager.java | 20 +++++----- .../com/nearinfinity/blur/thrift/Connection.java | 22 +++++++++- .../blur/thrift/commands/BlurCommand.java | 20 +++++----- src/blur-util/pom.xml | 19 +++++++++ .../com/nearinfinity/blur/BlurConfiguration.java | 24 +++++++++-- .../blur/concurrent/ExecutionContext.java | 16 +++++++ .../nearinfinity/blur/concurrent/Executors.java | 20 +++++----- .../concurrent/SimpleUncaughtExceptionHandler.java | 16 +++++++ .../blur/concurrent/ThreadWatcher.java | 18 ++++++++- .../main/java/com/nearinfinity/blur/log/Log.java | 28 ++++++------ .../java/com/nearinfinity/blur/log/LogFactory.java | 28 ++++++------ .../java/com/nearinfinity/blur/log/LogImpl.java | 20 +++++----- .../com/nearinfinity/blur/metrics/BlurMetrics.java | 28 ++++++++++--- .../nearinfinity/blur/zookeeper/WatchChildren.java | 16 +++++++ .../nearinfinity/blur/zookeeper/WatchNodeData.java | 16 +++++++ .../blur/zookeeper/WatchNodeExistance.java | 16 +++++++ .../com/nearinfinity/blur/zookeeper/ZkUtils.java | 20 +++++----- .../src/main/resources/blur-default.properties | 15 +++++++ .../src/main/resources/blur-site.properties | 15 +++++++ .../nearinfinity/blur/zookeeper/ZkUtilsTest.java | 22 +++++----- 25 files changed, 379 insertions(+), 135 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/99218cd2/src/blur-thrift/pom.xml ---------------------------------------------------------------------- diff --git a/src/blur-thrift/pom.xml b/src/blur-thrift/pom.xml index 0d3a1d3..7059add 100644 --- a/src/blur-thrift/pom.xml +++ b/src/blur-thrift/pom.xml @@ -1,3 +1,22 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- +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. +--> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/99218cd2/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/AbstractCommand.java ---------------------------------------------------------------------- diff --git a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/AbstractCommand.java b/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/AbstractCommand.java index db010c8..ccb7784 100644 --- a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/AbstractCommand.java +++ b/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/AbstractCommand.java @@ -1,11 +1,14 @@ -/* - * Copyright (C) 2011 Near Infinity Corporation - * - * Licensed 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 +package com.nearinfinity.blur.thrift; + +/** + * 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 + * 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, @@ -13,18 +16,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -package com.nearinfinity.blur.thrift; - import org.apache.thrift.TException; import com.nearinfinity.blur.thrift.generated.BlurException; -public abstract class AbstractCommand<CLIENT,T> implements Cloneable { - public abstract T call(CLIENT client) throws BlurException,TException; +public abstract class AbstractCommand<CLIENT, T> implements Cloneable { + public abstract T call(CLIENT client) throws BlurException, TException; - @Override - protected Object clone() throws CloneNotSupportedException { - return super.clone(); - } + @Override + protected Object clone() throws CloneNotSupportedException { + return super.clone(); + } } http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/99218cd2/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/AsyncClientPool.java ---------------------------------------------------------------------- diff --git a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/AsyncClientPool.java b/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/AsyncClientPool.java index 4f6d40a..2f4b017 100644 --- a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/AsyncClientPool.java +++ b/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/AsyncClientPool.java @@ -1,11 +1,14 @@ -/* - * Copyright (C) 2011 Near Infinity Corporation - * - * Licensed 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 +package com.nearinfinity.blur.thrift; + +/** + * 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 + * 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, @@ -13,9 +16,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -package com.nearinfinity.blur.thrift; - import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.Field; @@ -61,7 +61,7 @@ public class AsyncClientPool { private TAsyncClientManager _clientManager; private Collection<TNonblockingTransport> _transports = new LinkedBlockingQueue<TNonblockingTransport>(); private Field _transportField; - + private Random random = new Random(); public AsyncClientPool() throws IOException { @@ -103,9 +103,9 @@ public class AsyncClientPool { */ @SuppressWarnings("unchecked") public <T> T getClient(final Class<T> asyncIfaceClass, final String connectionStr) { - List<Connection> connections = BlurClientManager.getConnections(connectionStr); - Collections.shuffle(connections, random); - //randomness ftw + List<Connection> connections = BlurClientManager.getConnections(connectionStr); + Collections.shuffle(connections, random); + // randomness ftw final Connection connection = connections.get(0); return (T) Proxy.newProxyInstance(asyncIfaceClass.getClassLoader(), new Class[] { asyncIfaceClass }, new InvocationHandler() { @Override http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/99218cd2/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/BException.java ---------------------------------------------------------------------- diff --git a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/BException.java b/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/BException.java index 2dd41e9..932c90e 100644 --- a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/BException.java +++ b/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/BException.java @@ -1,5 +1,21 @@ package com.nearinfinity.blur.thrift; +/** + * 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. + */ import java.io.ByteArrayOutputStream; import java.io.PrintWriter; import java.text.MessageFormat; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/99218cd2/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/BlurClient.java ---------------------------------------------------------------------- diff --git a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/BlurClient.java b/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/BlurClient.java index c19e4bd..478d1af 100644 --- a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/BlurClient.java +++ b/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/BlurClient.java @@ -1,5 +1,21 @@ package com.nearinfinity.blur.thrift; +/** + * 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. + */ import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -55,11 +71,11 @@ public class BlurClient { List<Connection> connections = BlurClientManager.getConnections(connectionStr); return getClient(connections); } - + public static Iface getClient(Connection connection) { return getClient(Arrays.asList(connection)); } - + public static Iface getClient(List<Connection> connections) { return (Iface) Proxy.newProxyInstance(Iface.class.getClassLoader(), new Class[] { Iface.class }, new BlurClientInvocationHandler(connections)); } http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/99218cd2/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/BlurClientManager.java ---------------------------------------------------------------------- diff --git a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/BlurClientManager.java b/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/BlurClientManager.java index affc956..4d14c4f 100644 --- a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/BlurClientManager.java +++ b/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/BlurClientManager.java @@ -1,11 +1,14 @@ -/* - * Copyright (C) 2011 Near Infinity Corporation - * - * Licensed 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 +package com.nearinfinity.blur.thrift; + +/** + * 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 + * 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, @@ -13,9 +16,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -package com.nearinfinity.blur.thrift; - import java.io.IOException; import java.net.InetSocketAddress; import java.net.Proxy; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/99218cd2/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/Connection.java ---------------------------------------------------------------------- diff --git a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/Connection.java b/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/Connection.java index 9f02017..e3d79ee 100644 --- a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/Connection.java +++ b/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/Connection.java @@ -1,8 +1,24 @@ package com.nearinfinity.blur.thrift; +/** + * 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. + */ public class Connection { - + private int _port; private String _host; private String _proxyHost; @@ -14,12 +30,12 @@ public class Connection { if (index >= 0) { _host = connectionStr.substring(0, index); _port = Integer.parseInt(connectionStr.substring(index + 1)); - //@TODO make this connection parse proxy ports as well + // @TODO make this connection parse proxy ports as well } else { throw new RuntimeException("Connection string of [" + connectionStr + "] does not match 'host1:port,host2:port,...'"); } } - + public Connection(String host, int port, String proxyHost, int proxyPort) { _port = port; _host = host; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/99218cd2/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/commands/BlurCommand.java ---------------------------------------------------------------------- diff --git a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/commands/BlurCommand.java b/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/commands/BlurCommand.java index 82fc5bc..7a43ad8 100644 --- a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/commands/BlurCommand.java +++ b/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/commands/BlurCommand.java @@ -1,11 +1,14 @@ -/* - * Copyright (C) 2011 Near Infinity Corporation - * - * Licensed 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 +package com.nearinfinity.blur.thrift.commands; + +/** + * 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 + * 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, @@ -13,9 +16,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -package com.nearinfinity.blur.thrift.commands; - import com.nearinfinity.blur.thrift.AbstractCommand; import com.nearinfinity.blur.thrift.generated.Blur; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/99218cd2/src/blur-util/pom.xml ---------------------------------------------------------------------- diff --git a/src/blur-util/pom.xml b/src/blur-util/pom.xml index 4e41a83..bb7714c 100644 --- a/src/blur-util/pom.xml +++ b/src/blur-util/pom.xml @@ -1,3 +1,22 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- +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. +--> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/99218cd2/src/blur-util/src/main/java/com/nearinfinity/blur/BlurConfiguration.java ---------------------------------------------------------------------- diff --git a/src/blur-util/src/main/java/com/nearinfinity/blur/BlurConfiguration.java b/src/blur-util/src/main/java/com/nearinfinity/blur/BlurConfiguration.java index 30d338a..2dcc650 100644 --- a/src/blur-util/src/main/java/com/nearinfinity/blur/BlurConfiguration.java +++ b/src/blur-util/src/main/java/com/nearinfinity/blur/BlurConfiguration.java @@ -1,5 +1,21 @@ package com.nearinfinity.blur; +/** + * 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. + */ import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; @@ -37,10 +53,10 @@ public class BlurConfiguration { properties.load(inputStream); return properties; } - - public Map<String,String> getProperties() { - Map<String,String> result = new HashMap<String, String>(); - for (Entry<Object,Object> e : _properties.entrySet()) { + + public Map<String, String> getProperties() { + Map<String, String> result = new HashMap<String, String>(); + for (Entry<Object, Object> e : _properties.entrySet()) { result.put(e.getKey().toString(), e.getValue().toString()); } return result; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/99218cd2/src/blur-util/src/main/java/com/nearinfinity/blur/concurrent/ExecutionContext.java ---------------------------------------------------------------------- diff --git a/src/blur-util/src/main/java/com/nearinfinity/blur/concurrent/ExecutionContext.java b/src/blur-util/src/main/java/com/nearinfinity/blur/concurrent/ExecutionContext.java index de155d3..0dad24b 100644 --- a/src/blur-util/src/main/java/com/nearinfinity/blur/concurrent/ExecutionContext.java +++ b/src/blur-util/src/main/java/com/nearinfinity/blur/concurrent/ExecutionContext.java @@ -1,5 +1,21 @@ package com.nearinfinity.blur.concurrent; +/** + * 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. + */ import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/99218cd2/src/blur-util/src/main/java/com/nearinfinity/blur/concurrent/Executors.java ---------------------------------------------------------------------- diff --git a/src/blur-util/src/main/java/com/nearinfinity/blur/concurrent/Executors.java b/src/blur-util/src/main/java/com/nearinfinity/blur/concurrent/Executors.java index 3de1b94..e4071bb 100644 --- a/src/blur-util/src/main/java/com/nearinfinity/blur/concurrent/Executors.java +++ b/src/blur-util/src/main/java/com/nearinfinity/blur/concurrent/Executors.java @@ -1,11 +1,14 @@ -/* - * Copyright (C) 2011 Near Infinity Corporation - * - * Licensed 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 +package com.nearinfinity.blur.concurrent; + +/** + * 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 + * 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, @@ -13,9 +16,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -package com.nearinfinity.blur.concurrent; - import java.util.concurrent.ExecutorService; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadFactory; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/99218cd2/src/blur-util/src/main/java/com/nearinfinity/blur/concurrent/SimpleUncaughtExceptionHandler.java ---------------------------------------------------------------------- diff --git a/src/blur-util/src/main/java/com/nearinfinity/blur/concurrent/SimpleUncaughtExceptionHandler.java b/src/blur-util/src/main/java/com/nearinfinity/blur/concurrent/SimpleUncaughtExceptionHandler.java index 8249795..63afad3 100644 --- a/src/blur-util/src/main/java/com/nearinfinity/blur/concurrent/SimpleUncaughtExceptionHandler.java +++ b/src/blur-util/src/main/java/com/nearinfinity/blur/concurrent/SimpleUncaughtExceptionHandler.java @@ -1,5 +1,21 @@ package com.nearinfinity.blur.concurrent; +/** + * 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. + */ import com.nearinfinity.blur.log.Log; import com.nearinfinity.blur.log.LogFactory; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/99218cd2/src/blur-util/src/main/java/com/nearinfinity/blur/concurrent/ThreadWatcher.java ---------------------------------------------------------------------- diff --git a/src/blur-util/src/main/java/com/nearinfinity/blur/concurrent/ThreadWatcher.java b/src/blur-util/src/main/java/com/nearinfinity/blur/concurrent/ThreadWatcher.java index a229698..134b72f 100644 --- a/src/blur-util/src/main/java/com/nearinfinity/blur/concurrent/ThreadWatcher.java +++ b/src/blur-util/src/main/java/com/nearinfinity/blur/concurrent/ThreadWatcher.java @@ -1,5 +1,21 @@ package com.nearinfinity.blur.concurrent; +/** + * 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. + */ import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -58,7 +74,7 @@ public class ThreadWatcher { try { processRunningThreads(); } catch (Throwable t) { - LOG.error("Unknown error",t); + LOG.error("Unknown error", t); } } }, TimeUnit.SECONDS.toMillis(5), TimeUnit.SECONDS.toMillis(5)); http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/99218cd2/src/blur-util/src/main/java/com/nearinfinity/blur/log/Log.java ---------------------------------------------------------------------- diff --git a/src/blur-util/src/main/java/com/nearinfinity/blur/log/Log.java b/src/blur-util/src/main/java/com/nearinfinity/blur/log/Log.java index 8eb86c3..bd92245 100644 --- a/src/blur-util/src/main/java/com/nearinfinity/blur/log/Log.java +++ b/src/blur-util/src/main/java/com/nearinfinity/blur/log/Log.java @@ -1,21 +1,21 @@ -/* - * Copyright (C) 2011 Near Infinity Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. +package com.nearinfinity.blur.log; + +/** + * 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. + * 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 com.nearinfinity.blur.log; - public interface Log extends org.apache.commons.logging.Log { public void trace(Object message, Object... args); http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/99218cd2/src/blur-util/src/main/java/com/nearinfinity/blur/log/LogFactory.java ---------------------------------------------------------------------- diff --git a/src/blur-util/src/main/java/com/nearinfinity/blur/log/LogFactory.java b/src/blur-util/src/main/java/com/nearinfinity/blur/log/LogFactory.java index 1195d5b..535310e 100644 --- a/src/blur-util/src/main/java/com/nearinfinity/blur/log/LogFactory.java +++ b/src/blur-util/src/main/java/com/nearinfinity/blur/log/LogFactory.java @@ -1,21 +1,21 @@ -/* - * Copyright (C) 2011 Near Infinity Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. +package com.nearinfinity.blur.log; + +/** + * 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. + * 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 com.nearinfinity.blur.log; - public class LogFactory { public static Log getLog(Class<?> c) { http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/99218cd2/src/blur-util/src/main/java/com/nearinfinity/blur/log/LogImpl.java ---------------------------------------------------------------------- diff --git a/src/blur-util/src/main/java/com/nearinfinity/blur/log/LogImpl.java b/src/blur-util/src/main/java/com/nearinfinity/blur/log/LogImpl.java index a3087a8..f635c55 100644 --- a/src/blur-util/src/main/java/com/nearinfinity/blur/log/LogImpl.java +++ b/src/blur-util/src/main/java/com/nearinfinity/blur/log/LogImpl.java @@ -1,11 +1,14 @@ -/* - * Copyright (C) 2011 Near Infinity Corporation - * - * Licensed 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 +package com.nearinfinity.blur.log; + +/** + * 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 + * 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, @@ -13,9 +16,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -package com.nearinfinity.blur.log; - import java.text.MessageFormat; public class LogImpl implements Log { http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/99218cd2/src/blur-util/src/main/java/com/nearinfinity/blur/metrics/BlurMetrics.java ---------------------------------------------------------------------- diff --git a/src/blur-util/src/main/java/com/nearinfinity/blur/metrics/BlurMetrics.java b/src/blur-util/src/main/java/com/nearinfinity/blur/metrics/BlurMetrics.java index 092a8ce..bc88d53 100644 --- a/src/blur-util/src/main/java/com/nearinfinity/blur/metrics/BlurMetrics.java +++ b/src/blur-util/src/main/java/com/nearinfinity/blur/metrics/BlurMetrics.java @@ -1,5 +1,21 @@ package com.nearinfinity.blur.metrics; +/** + * 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. + */ import java.util.Map; import java.util.Map.Entry; import java.util.concurrent.ConcurrentHashMap; @@ -13,7 +29,7 @@ import org.apache.hadoop.metrics.Updater; import org.apache.hadoop.metrics.jvm.JvmMetrics; public class BlurMetrics implements Updater { - + public static class MethodCall { public AtomicLong invokes = new AtomicLong(); public AtomicLong times = new AtomicLong(); @@ -33,8 +49,8 @@ public class BlurMetrics implements Updater { public AtomicLong blurShardBuffercacheAllocate8192 = new AtomicLong(0); public AtomicLong blurShardBuffercacheAllocateOther = new AtomicLong(0); public AtomicLong blurShardBuffercacheLost = new AtomicLong(0); - public Map<String,MethodCall> methodCalls = new ConcurrentHashMap<String, MethodCall>(); - + public Map<String, MethodCall> methodCalls = new ConcurrentHashMap<String, MethodCall>(); + public AtomicLong tableCount = new AtomicLong(0); public AtomicLong rowCount = new AtomicLong(0); public AtomicLong recordCount = new AtomicLong(0); @@ -49,7 +65,7 @@ public class BlurMetrics implements Updater { Configuration conf = new Configuration(); BlurMetrics blurMetrics = new BlurMetrics(conf); MethodCall methodCall = new MethodCall(); - blurMetrics.methodCalls.put("test",methodCall); + blurMetrics.methodCalls.put("test", methodCall); for (int i = 0; i < 100; i++) { blurMetrics.blockCacheHit.incrementAndGet(); blurMetrics.blockCacheMiss.incrementAndGet(); @@ -81,12 +97,12 @@ public class BlurMetrics implements Updater { _metricsRecord.setMetric("record.writes", getPerSecond(recordWrites.getAndSet(0), seconds)); _metricsRecord.setMetric("query.external", getPerSecond(queriesExternal.getAndSet(0), seconds)); _metricsRecord.setMetric("query.internal", getPerSecond(queriesInternal.getAndSet(0), seconds)); - for (Entry<String,MethodCall> entry : methodCalls.entrySet()) { + for (Entry<String, MethodCall> entry : methodCalls.entrySet()) { String key = entry.getKey(); MethodCall value = entry.getValue(); long invokes = value.invokes.getAndSet(0); long times = value.times.getAndSet(0); - + float avgTimes = (times / (float) invokes) / 1000000000.0f; _metricsRecord.setMetric("methodcalls." + key + ".count", getPerSecond(invokes, seconds)); _metricsRecord.setMetric("methodcalls." + key + ".time", avgTimes); http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/99218cd2/src/blur-util/src/main/java/com/nearinfinity/blur/zookeeper/WatchChildren.java ---------------------------------------------------------------------- diff --git a/src/blur-util/src/main/java/com/nearinfinity/blur/zookeeper/WatchChildren.java b/src/blur-util/src/main/java/com/nearinfinity/blur/zookeeper/WatchChildren.java index 7a9bf1d..c05f474 100644 --- a/src/blur-util/src/main/java/com/nearinfinity/blur/zookeeper/WatchChildren.java +++ b/src/blur-util/src/main/java/com/nearinfinity/blur/zookeeper/WatchChildren.java @@ -1,5 +1,21 @@ package com.nearinfinity.blur.zookeeper; +/** + * 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. + */ import java.io.Closeable; import java.io.PrintWriter; import java.io.StringWriter; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/99218cd2/src/blur-util/src/main/java/com/nearinfinity/blur/zookeeper/WatchNodeData.java ---------------------------------------------------------------------- diff --git a/src/blur-util/src/main/java/com/nearinfinity/blur/zookeeper/WatchNodeData.java b/src/blur-util/src/main/java/com/nearinfinity/blur/zookeeper/WatchNodeData.java index cce1eed..08b7948 100644 --- a/src/blur-util/src/main/java/com/nearinfinity/blur/zookeeper/WatchNodeData.java +++ b/src/blur-util/src/main/java/com/nearinfinity/blur/zookeeper/WatchNodeData.java @@ -1,5 +1,21 @@ package com.nearinfinity.blur.zookeeper; +/** + * 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. + */ import java.io.Closeable; import java.util.Arrays; import java.util.UUID; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/99218cd2/src/blur-util/src/main/java/com/nearinfinity/blur/zookeeper/WatchNodeExistance.java ---------------------------------------------------------------------- diff --git a/src/blur-util/src/main/java/com/nearinfinity/blur/zookeeper/WatchNodeExistance.java b/src/blur-util/src/main/java/com/nearinfinity/blur/zookeeper/WatchNodeExistance.java index 7d0a172..076f878 100644 --- a/src/blur-util/src/main/java/com/nearinfinity/blur/zookeeper/WatchNodeExistance.java +++ b/src/blur-util/src/main/java/com/nearinfinity/blur/zookeeper/WatchNodeExistance.java @@ -1,5 +1,21 @@ package com.nearinfinity.blur.zookeeper; +/** + * 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. + */ import java.io.Closeable; import java.util.UUID; import java.util.concurrent.TimeUnit; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/99218cd2/src/blur-util/src/main/java/com/nearinfinity/blur/zookeeper/ZkUtils.java ---------------------------------------------------------------------- diff --git a/src/blur-util/src/main/java/com/nearinfinity/blur/zookeeper/ZkUtils.java b/src/blur-util/src/main/java/com/nearinfinity/blur/zookeeper/ZkUtils.java index 5454f79..116bab8 100644 --- a/src/blur-util/src/main/java/com/nearinfinity/blur/zookeeper/ZkUtils.java +++ b/src/blur-util/src/main/java/com/nearinfinity/blur/zookeeper/ZkUtils.java @@ -1,11 +1,14 @@ -/* - * Copyright (C) 2011 Near Infinity Corporation - * - * Licensed 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 +package com.nearinfinity.blur.zookeeper; + +/** + * 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 + * 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, @@ -13,9 +16,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -package com.nearinfinity.blur.zookeeper; - import java.io.IOException; import java.util.List; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/99218cd2/src/blur-util/src/main/resources/blur-default.properties ---------------------------------------------------------------------- diff --git a/src/blur-util/src/main/resources/blur-default.properties b/src/blur-util/src/main/resources/blur-default.properties index 8d87db4..c57c374 100644 --- a/src/blur-util/src/main/resources/blur-default.properties +++ b/src/blur-util/src/main/resources/blur-default.properties @@ -1,3 +1,18 @@ +# 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. + blur.shard.hostname= blur.shard.bind.address=0.0.0.0 blur.shard.bind.port=40020 http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/99218cd2/src/blur-util/src/main/resources/blur-site.properties ---------------------------------------------------------------------- diff --git a/src/blur-util/src/main/resources/blur-site.properties b/src/blur-util/src/main/resources/blur-site.properties index bcfe3b3..18ae6f1 100644 --- a/src/blur-util/src/main/resources/blur-site.properties +++ b/src/blur-util/src/main/resources/blur-site.properties @@ -1,2 +1,17 @@ +# 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. + blur.zookeeper.connection=127.0.0.1 blur.cluster.name=default http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/99218cd2/src/blur-util/src/test/java/com/nearinfinity/blur/zookeeper/ZkUtilsTest.java ---------------------------------------------------------------------- diff --git a/src/blur-util/src/test/java/com/nearinfinity/blur/zookeeper/ZkUtilsTest.java b/src/blur-util/src/test/java/com/nearinfinity/blur/zookeeper/ZkUtilsTest.java index 0feb204..2dd0449 100644 --- a/src/blur-util/src/test/java/com/nearinfinity/blur/zookeeper/ZkUtilsTest.java +++ b/src/blur-util/src/test/java/com/nearinfinity/blur/zookeeper/ZkUtilsTest.java @@ -1,11 +1,14 @@ -/* - * Copyright (C) 2011 Near Infinity Corporation - * - * Licensed 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 +package com.nearinfinity.blur.zookeeper; + +/** + * 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 + * 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, @@ -13,9 +16,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -package com.nearinfinity.blur.zookeeper; - import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.nullValue; @@ -67,7 +67,7 @@ public class ZkUtilsTest { }); lock.wait(); } - + } @After
