Skip to content

Commit

Permalink
issue #49: tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
bluestreak01 committed May 26, 2016
1 parent 200e0cb commit 73cf779
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 49 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/com/questdb/BootstrapMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class BootstrapMain {

@SuppressFBWarnings("PATH_TRAVERSAL_IN")
public static void main(String[] args) throws Exception {
System.out.printf("QDB HTTP Server 3.0\nCopyright (C) Appsicle 2014-2016, all rights reserved.\n\n");
System.out.printf("QDB HTTP Server 3.0%nCopyright (C) Appsicle 2014-2016, all rights reserved.%n%n");
if (args.length < 1) {
System.out.println("Root directory name expected");
return;
Expand Down
22 changes: 12 additions & 10 deletions core/src/main/java/com/questdb/mp/Worker.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
/*******************************************************************************
* ___ _ ____ ____
* / _ \ _ _ ___ ___| |_| _ \| __ )
* | | | | | | |/ _ \/ __| __| | | | _ \
* | |_| | |_| | __/\__ \ |_| |_| | |_) |
* \__\_\\__,_|\___||___/\__|____/|____/
* <p>
* ___ _ ____ ____
* / _ \ _ _ ___ ___| |_| _ \| __ )
* | | | | | | |/ _ \/ __| __| | | | _ \
* | |_| | |_| | __/\__ \ |_| |_| | |_) |
* \__\_\\__,_|\___||___/\__|____/|____/
*
* Copyright (C) 2014-2016 Appsicle
* <p>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
* <p>
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
* <p>
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* <p>
*
* As a special exception, the copyright holders give permission to link the
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
Expand All @@ -30,6 +30,7 @@
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also delete
* it in the license file.
*
******************************************************************************/

package com.questdb.mp;
Expand Down Expand Up @@ -110,6 +111,7 @@ private int loadFence() {
return fence;
}

@SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT")
private void setupJobs() {
if (running == 1) {
for (int i = 0; i < jobs.size(); i++) {
Expand Down
23 changes: 12 additions & 11 deletions core/src/main/java/com/questdb/net/Epoll.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
/*******************************************************************************
* ___ _ ____ ____
* / _ \ _ _ ___ ___| |_| _ \| __ )
* | | | | | | |/ _ \/ __| __| | | | _ \
* | |_| | |_| | __/\__ \ |_| |_| | |_) |
* \__\_\\__,_|\___||___/\__|____/|____/
* <p>
* ___ _ ____ ____
* / _ \ _ _ ___ ___| |_| _ \| __ )
* | | | | | | |/ _ \/ __| __| | | | _ \
* | |_| | |_| | __/\__ \ |_| |_| | |_) |
* \__\_\\__,_|\___||___/\__|____/|____/
*
* Copyright (C) 2014-2016 Appsicle
* <p>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
* <p>
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
* <p>
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* <p>
*
* As a special exception, the copyright holders give permission to link the
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
Expand All @@ -30,6 +30,7 @@
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also delete
* it in the license file.
*
******************************************************************************/

package com.questdb.net;
Expand Down Expand Up @@ -59,7 +60,7 @@ public final class Epoll implements Closeable {

public Epoll(int capacity) {
this.capacity = capacity;
this.events = _rPtr = Unsafe.getUnsafe().allocateMemory(SIZEOF_EVENT * capacity);
this.events = _rPtr = Unsafe.getUnsafe().allocateMemory(SIZEOF_EVENT * (long) capacity);
this.epfd = epollCreate();
}

Expand Down
23 changes: 12 additions & 11 deletions core/src/main/java/com/questdb/net/Kqueue.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
/*******************************************************************************
* ___ _ ____ ____
* / _ \ _ _ ___ ___| |_| _ \| __ )
* | | | | | | |/ _ \/ __| __| | | | _ \
* | |_| | |_| | __/\__ \ |_| |_| | |_) |
* \__\_\\__,_|\___||___/\__|____/|____/
* <p>
* ___ _ ____ ____
* / _ \ _ _ ___ ___| |_| _ \| __ )
* | | | | | | |/ _ \/ __| __| | | | _ \
* | |_| | |_| | __/\__ \ |_| |_| | |_) |
* \__\_\\__,_|\___||___/\__|____/|____/
*
* Copyright (C) 2014-2016 Appsicle
* <p>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
* <p>
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
* <p>
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* <p>
*
* As a special exception, the copyright holders give permission to link the
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
Expand All @@ -30,6 +30,7 @@
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also delete
* it in the license file.
*
******************************************************************************/

package com.questdb.net;
Expand Down Expand Up @@ -61,7 +62,7 @@ public final class Kqueue implements Closeable {

public Kqueue(int capacity) {
this.capacity = capacity;
this.eventList = this._rPtr = Unsafe.getUnsafe().allocateMemory(SIZEOF_KEVENT * capacity);
this.eventList = this._rPtr = Unsafe.getUnsafe().allocateMemory(SIZEOF_KEVENT * (long) capacity);
this.kq = kqueue();
}

Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/com/questdb/net/http/EpollDispatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private void accept(long timestamp) {
break;
}

LOG.debug().$(" Connected ").$(_fd).$();
LOG.info().$(" Connected ").$(_fd).$();

if (Net.configureNonBlocking(_fd) < 0) {
LOG.error().$("Cannot make FD non-blocking").$();
Expand Down Expand Up @@ -172,7 +172,7 @@ private void addPending(long _fd, long timestamp) {
}

private void disconnect(IOContext context, DisconnectReason reason) {
LOG.debug().$("Disconnected ").$(context.channel.getFd()).$(": ").$(reason).$();
LOG.info().$("Disconnected ").$(context.channel.getFd()).$(": ").$(reason).$();
context.close();
connectionCount--;
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/com/questdb/net/http/KQueueDispatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public void registerChannel(IOContext context, ChannelStatus status) {

private long accept() {
long _fd = Net.accept(socketFd);
LOG.debug().$(" Connected ").$(_fd).$();
LOG.info().$(" Connected ").$(_fd).$();

// something not right
if (_fd < 0) {
Expand Down Expand Up @@ -166,7 +166,7 @@ private void addPending(long _fd, long timestamp) {
}

private void disconnect(IOContext context, DisconnectReason reason) {
LOG.debug().$("Disconnected ").$(context.channel.getFd()).$(": ").$(reason).$();
LOG.info().$("Disconnected ").$(context.channel.getFd()).$(": ").$(reason).$();
context.close();
connectionCount--;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ private void accept(long timestamp) {
break;
}

LOG.debug().$(" Connected ").$(_fd).$();
LOG.info().$(" Connected ").$(_fd).$();

if (Net.configureNonBlocking(_fd) < 0) {
LOG.error().$("Cannot make FD non-blocking").$();
Expand Down Expand Up @@ -188,7 +188,7 @@ private void addPending(long _fd, long timestamp) {
}

private void disconnect(IOContext context, DisconnectReason reason) {
LOG.debug().$("Disconnected ").$(context.channel.getFd()).$(": ").$(reason).$();
LOG.info().$("Disconnected ").$(context.channel.getFd()).$(": ").$(reason).$();
context.close();
connectionCount--;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import com.questdb.std.LocalValue;
import com.questdb.std.Mutable;
import com.questdb.store.ColumnType;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.io.Closeable;
import java.io.IOException;
Expand Down Expand Up @@ -82,6 +83,7 @@ public void handle(IOContext context) throws IOException {
}
}

@SuppressFBWarnings("SF_SWITCH_FALLTHROUGH")
@SuppressWarnings("ConstantConditions")
@Override
public void resume(IOContext context) throws IOException {
Expand Down
24 changes: 14 additions & 10 deletions core/src/main/java/com/questdb/net/http/handlers/ImportHandler.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
/*******************************************************************************
* ___ _ ____ ____
* / _ \ _ _ ___ ___| |_| _ \| __ )
* | | | | | | |/ _ \/ __| __| | | | _ \
* | |_| | |_| | __/\__ \ |_| |_| | |_) |
* \__\_\\__,_|\___||___/\__|____/|____/
* <p>
* ___ _ ____ ____
* / _ \ _ _ ___ ___| |_| _ \| __ )
* | | | | | | |/ _ \/ __| __| | | | _ \
* | |_| | |_| | __/\__ \ |_| |_| | |_) |
* \__\_\\__,_|\___||___/\__|____/|____/
*
* Copyright (C) 2014-2016 Appsicle
* <p>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
* <p>
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
* <p>
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* <p>
*
* As a special exception, the copyright holders give permission to link the
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
Expand All @@ -30,6 +30,7 @@
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also delete
* it in the license file.
*
******************************************************************************/

package com.questdb.net.http.handlers;
Expand All @@ -54,6 +55,7 @@
import com.questdb.net.http.RequestHeaderBuffer;
import com.questdb.net.http.ResponseSink;
import com.questdb.std.*;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.io.Closeable;
import java.io.IOException;
Expand Down Expand Up @@ -192,6 +194,7 @@ public void setupThread() {
PARSER.set(FormatParser.FACTORY.newInstance());
}

@SuppressFBWarnings("SF_SWITCH_FALLTHROUGH")
private static void resumeJson(ImportHandlerContext ctx, ChunkedResponse r) throws DisconnectedChannelException, SlowWritableChannelException {
final JournalMetadata m = ctx.importer.getMetadata();
final int columnCount = m.getColumnCount();
Expand Down Expand Up @@ -290,6 +293,7 @@ private static void col(CharSink b, ColumnMetadata m) {
);
}

@SuppressFBWarnings("SF_SWITCH_FALLTHROUGH")
private static void resumeText(ImportHandlerContext h, ChunkedResponse r) throws IOException {
JournalMetadata m = h.importer.getMetadata();
LongList errors = h.importer.getErrors();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import com.questdb.std.CharSink;
import com.questdb.std.DirectInputStream;
import com.questdb.store.ColumnType;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.io.OutputStream;

Expand Down Expand Up @@ -105,6 +106,7 @@ public boolean hasNext() {
return !done && (done = true);
}

@SuppressFBWarnings("IT_NO_SUCH_ELEMENT")
@Override
public Record next() {
return record;
Expand Down

0 comments on commit 73cf779

Please sign in to comment.