Skip to content

Commit 69cf650

Browse files
author
Larry McQueary
committed
reduced method visibility also
1 parent b53e166 commit 69cf650

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/main/java/io/nats/client/Channel.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,27 @@ class Channel<T> {
3030
T defaultVal = null;
3131
boolean closed = false;
3232

33-
public Channel() {
33+
Channel() {
3434
this(-1);
3535
}
3636

37-
public Channel(LinkedBlockingQueue<T> queue) {
37+
Channel(LinkedBlockingQueue<T> queue) {
3838
q = queue;
3939
}
4040

41-
public Channel(int capacity) {
41+
Channel(int capacity) {
4242
if (capacity <= 0) {
4343
q = new LinkedBlockingQueue<T>();
4444
} else {
4545
q = new LinkedBlockingQueue<T>(capacity);
4646
}
4747
}
4848

49-
public Channel(Collection<T> collection) {
49+
Channel(Collection<T> collection) {
5050
q = new LinkedBlockingQueue<T>(collection);
5151
}
5252

53-
public T get() {
53+
T get() {
5454
T result = defaultVal;
5555
try {
5656
result = get(-1, TimeUnit.MILLISECONDS);
@@ -61,11 +61,11 @@ public T get() {
6161
return result;
6262
}
6363

64-
public synchronized T get(long timeout) throws TimeoutException {
64+
synchronized T get(long timeout) throws TimeoutException {
6565
return (get(timeout, TimeUnit.MILLISECONDS));
6666
}
6767

68-
public T get(long timeout, TimeUnit unit) throws TimeoutException {
68+
T get(long timeout, TimeUnit unit) throws TimeoutException {
6969
T item = defaultVal;
7070

7171
try {
@@ -82,7 +82,7 @@ public T get(long timeout, TimeUnit unit) throws TimeoutException {
8282
return item;
8383
}
8484

85-
// public T getNew(long timeout, TimeUnit unit) throws TimeoutException {
85+
// T getNew(long timeout, TimeUnit unit) throws TimeoutException {
8686
// // System.err.printf("get called with timeout=%d, unit=%s\n", timeout, unit);
8787
// T item = null;
8888
// ExecutorService executor = Executors.newSingleThreadExecutor();
@@ -119,12 +119,12 @@ public T get(long timeout, TimeUnit unit) throws TimeoutException {
119119
// }
120120

121121

122-
public T poll() {
122+
T poll() {
123123
return q.poll();
124124
}
125125

126126
// Will throw NullPointerException if you try to insert a null item
127-
public boolean add(T item) {
127+
boolean add(T item) {
128128
// offer(T e) is used here simply to eliminate exceptions. add returns false only
129129
// if adding the item would have exceeded the capacity of a bounded queue.
130130
if (isClosed()) {
@@ -133,24 +133,24 @@ public boolean add(T item) {
133133
return q.offer(item);
134134
}
135135

136-
public boolean add(T item, long timeout, TimeUnit unit) throws InterruptedException {
136+
boolean add(T item, long timeout, TimeUnit unit) throws InterruptedException {
137137
if (isClosed()) {
138138
return false;
139139
}
140140
return q.offer(item, timeout, unit);
141141
}
142142

143-
public void close() {
143+
void close() {
144144
// logger.trace("Channel.close(), clearing queue");
145145
closed = true;
146146
q.clear();
147147
}
148148

149-
public boolean isClosed() {
149+
boolean isClosed() {
150150
return closed;
151151
}
152152

153-
public int getCount() {
153+
int getCount() {
154154
return q.size();
155155
}
156156
}

0 commit comments

Comments
 (0)