Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
ccfedc45
Unverified
Commit
ccfedc45
authored
Nov 05, 2019
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
秒表处理移到框架里
parent
50cf5144
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
95 deletions
+13
-95
src/main/java/org/b3log/solo/Server.java
src/main/java/org/b3log/solo/Server.java
+13
-6
src/main/java/org/b3log/solo/processor/StopwatchEndHandler.java
...in/java/org/b3log/solo/processor/StopwatchEndHandler.java
+0
-50
src/main/java/org/b3log/solo/processor/StopwatchStartHandler.java
.../java/org/b3log/solo/processor/StopwatchStartHandler.java
+0
-39
No files found.
src/main/java/org/b3log/solo/Server.java
View file @
ccfedc45
...
@@ -23,6 +23,8 @@ import org.b3log.latke.Latkes;
...
@@ -23,6 +23,8 @@ import org.b3log.latke.Latkes;
import
org.b3log.latke.event.EventManager
;
import
org.b3log.latke.event.EventManager
;
import
org.b3log.latke.http.BaseServer
;
import
org.b3log.latke.http.BaseServer
;
import
org.b3log.latke.http.Dispatcher
;
import
org.b3log.latke.http.Dispatcher
;
import
org.b3log.latke.http.handler.StopwatchEndHandler
;
import
org.b3log.latke.http.handler.StopwatchStartHandler
;
import
org.b3log.latke.ioc.BeanManager
;
import
org.b3log.latke.ioc.BeanManager
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.logging.Logger
;
...
@@ -35,7 +37,10 @@ import org.b3log.solo.event.B3ArticleSender;
...
@@ -35,7 +37,10 @@ import org.b3log.solo.event.B3ArticleSender;
import
org.b3log.solo.event.B3ArticleUpdater
;
import
org.b3log.solo.event.B3ArticleUpdater
;
import
org.b3log.solo.event.B3CommentSender
;
import
org.b3log.solo.event.B3CommentSender
;
import
org.b3log.solo.event.PluginRefresher
;
import
org.b3log.solo.event.PluginRefresher
;
import
org.b3log.solo.processor.*
;
import
org.b3log.solo.processor.ErrorProcessor
;
import
org.b3log.solo.processor.InitCheckHandler
;
import
org.b3log.solo.processor.PermalinkHandler
;
import
org.b3log.solo.processor.SkinHandler
;
import
org.b3log.solo.processor.console.*
;
import
org.b3log.solo.processor.console.*
;
import
org.b3log.solo.repository.OptionRepository
;
import
org.b3log.solo.repository.OptionRepository
;
import
org.b3log.solo.service.*
;
import
org.b3log.solo.service.*
;
...
@@ -67,6 +72,8 @@ public final class Server extends BaseServer {
...
@@ -67,6 +72,8 @@ public final class Server extends BaseServer {
* @param args the specified arguments
* @param args the specified arguments
*/
*/
public
static
void
main
(
final
String
[]
args
)
{
public
static
void
main
(
final
String
[]
args
)
{
Stopwatchs
.
start
(
"Booting"
);
final
Options
options
=
new
Options
();
final
Options
options
=
new
Options
();
final
Option
listenPortOpt
=
Option
.
builder
(
"lp"
).
longOpt
(
"listen_port"
).
argName
(
"LISTEN_PORT"
).
final
Option
listenPortOpt
=
Option
.
builder
(
"lp"
).
longOpt
(
"listen_port"
).
argName
(
"LISTEN_PORT"
).
hasArg
().
desc
(
"listen port, default is 8080"
).
build
();
hasArg
().
desc
(
"listen port, default is 8080"
).
build
();
...
@@ -184,7 +191,6 @@ public final class Server extends BaseServer {
...
@@ -184,7 +191,6 @@ public final class Server extends BaseServer {
Dispatcher
.
HANDLERS
.
add
(
3
,
new
PermalinkHandler
());
Dispatcher
.
HANDLERS
.
add
(
3
,
new
PermalinkHandler
());
Dispatcher
.
HANDLERS
.
add
(
4
,
new
StopwatchEndHandler
());
Dispatcher
.
HANDLERS
.
add
(
4
,
new
StopwatchEndHandler
());
routeConsoleProcessors
();
routeConsoleProcessors
();
Stopwatchs
.
start
(
"Context Initialized"
);
final
Latkes
.
RuntimeDatabase
runtimeDatabase
=
Latkes
.
getRuntimeDatabase
();
final
Latkes
.
RuntimeDatabase
runtimeDatabase
=
Latkes
.
getRuntimeDatabase
();
final
String
jdbcUsername
=
Latkes
.
getLocalProperty
(
"jdbc.username"
);
final
String
jdbcUsername
=
Latkes
.
getLocalProperty
(
"jdbc.username"
);
...
@@ -239,10 +245,6 @@ public final class Server extends BaseServer {
...
@@ -239,10 +245,6 @@ public final class Server extends BaseServer {
LOGGER
.
info
(
"Solo is running"
);
LOGGER
.
info
(
"Solo is running"
);
}
}
Stopwatchs
.
end
();
LOGGER
.
log
(
Level
.
DEBUG
,
"Stopwatch: {0}{1}"
,
Strings
.
LINE_SEPARATOR
,
Stopwatchs
.
getTimingStat
());
Stopwatchs
.
release
();
final
CronMgmtService
cronMgmtService
=
beanManager
.
getReference
(
CronMgmtService
.
class
);
final
CronMgmtService
cronMgmtService
=
beanManager
.
getReference
(
CronMgmtService
.
class
);
cronMgmtService
.
start
();
cronMgmtService
.
start
();
...
@@ -252,6 +254,11 @@ public final class Server extends BaseServer {
...
@@ -252,6 +254,11 @@ public final class Server extends BaseServer {
server
.
shutdown
();
server
.
shutdown
();
Latkes
.
shutdown
();
Latkes
.
shutdown
();
}));
}));
Stopwatchs
.
end
();
LOGGER
.
log
(
Level
.
DEBUG
,
"Stopwatch: {0}{1}"
,
Strings
.
LINE_SEPARATOR
,
Stopwatchs
.
getTimingStat
());
Stopwatchs
.
release
();
server
.
start
(
Integer
.
valueOf
(
portArg
));
server
.
start
(
Integer
.
valueOf
(
portArg
));
}
}
...
...
src/main/java/org/b3log/solo/processor/StopwatchEndHandler.java
deleted
100644 → 0
View file @
50cf5144
/*
* Solo - A small and beautiful blogging system written in Java.
* Copyright (c) 2010-present, b3log.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package
org
.
b3log
.
solo
.
processor
;
import
org.b3log.latke.http.RequestContext
;
import
org.b3log.latke.http.handler.Handler
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.util.Stopwatchs
;
import
org.b3log.latke.util.Strings
;
/**
* Stopwatch end handler.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.0, Nov 3, 2019
* @since 3.6.7
*/
public
class
StopwatchEndHandler
implements
Handler
{
/**
* Logger.
*/
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
StopwatchEndHandler
.
class
);
@Override
public
void
handle
(
final
RequestContext
context
)
{
Stopwatchs
.
end
();
LOGGER
.
log
(
Level
.
DEBUG
,
"Stopwatch: {0}{1}"
,
Strings
.
LINE_SEPARATOR
,
Stopwatchs
.
getTimingStat
());
Stopwatchs
.
release
();
context
.
handle
();
}
}
src/main/java/org/b3log/solo/processor/StopwatchStartHandler.java
deleted
100644 → 0
View file @
50cf5144
/*
* Solo - A small and beautiful blogging system written in Java.
* Copyright (c) 2010-present, b3log.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package
org
.
b3log
.
solo
.
processor
;
import
org.b3log.latke.http.RequestContext
;
import
org.b3log.latke.http.handler.Handler
;
import
org.b3log.latke.util.Stopwatchs
;
/**
* Stopwatch start handler.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.0, Nov 3, 2019
* @since 3.6.7
*/
public
class
StopwatchStartHandler
implements
Handler
{
@Override
public
void
handle
(
final
RequestContext
context
)
{
Stopwatchs
.
start
(
"Request Initialized [requestURI="
+
context
.
requestURI
()
+
"]"
);
context
.
handle
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment