001
014
015 package com.liferay.portal.kernel.util;
016
017 import java.util.Arrays;
018
019
022 public class ThreadLocalDistributorRegistry {
023
024 public static ThreadLocalDistributor[] getThreadLocalDistributors() {
025 return _threadLocalDistributors;
026 }
027
028 protected static int addThreadLocalDistributor(
029 ThreadLocalDistributor threadLocalDistributor) {
030
031 int newLength = _threadLocalDistributors.length + 1;
032
033 ThreadLocalDistributor[] threadLocalDistributors = Arrays.copyOf(
034 _threadLocalDistributors, newLength);
035
036 threadLocalDistributors[newLength - 1] = threadLocalDistributor;
037
038 _threadLocalDistributors = threadLocalDistributors;
039
040 return newLength - 1;
041 }
042
043 protected static ThreadLocalDistributor getThreadLocalDistributor(
044 int index) {
045
046 return _threadLocalDistributors[index];
047 }
048
049 private static ThreadLocalDistributor[] _threadLocalDistributors =
050 new ThreadLocalDistributor[0];
051
052 }