Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nouiWithSpringMVC
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
gechengyang
nouiWithSpringMVC
Commits
8122ae89
Commit
8122ae89
authored
Jan 19, 2021
by
fukai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除误提交的文件
parent
13addc6b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
72 deletions
+0
-72
VisitCounter.java
...main/java/org/sss/presentation/noui/jwt/VisitCounter.java
+0
-72
businessimp.jar
src/main/webapp/WEB-INF/lib/businessimp.jar
+0
-0
No files found.
src/main/java/org/sss/presentation/noui/jwt/VisitCounter.java
deleted
100644 → 0
View file @
13addc6b
package
org
.
sss
.
presentation
.
noui
.
jwt
;
import
java.util.Date
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
public
class
VisitCounter
{
private
int
timeSpan
;
private
int
count
;
private
Map
<
String
,
VisitCounterItem
>
couterMap
=
new
ConcurrentHashMap
<>();
public
VisitCounter
(
int
timeSpan
,
int
count
){
this
.
timeSpan
=
timeSpan
;
this
.
count
=
count
;
}
public
boolean
addCount
(
String
token
)
{
VisitCounterItem
item
=
null
;
synchronized
(
couterMap
)
{
item
=
couterMap
.
get
(
token
);
if
(
item
==
null
)
{
item
=
new
VisitCounterItem
(
timeSpan
,
count
);
couterMap
.
put
(
token
,
item
);
}
}
return
item
.
addCount
();
}
public
void
removeCount
(
String
token
)
{
}
public
static
class
VisitCounterItem
{
private
int
timeSpan
;
private
int
count
;
private
long
timestamp
;
private
int
visited
;
public
VisitCounterItem
(
int
timeSpan
,
int
count
)
{
this
.
timeSpan
=
timeSpan
*
1000
;
this
.
count
=
count
;
this
.
timestamp
=
new
Date
().
getTime
();
}
public
synchronized
boolean
addCount
()
{
long
time
=
new
Date
().
getTime
();
if
(
time
-
this
.
timestamp
>
timeSpan
)
{
resetCount
();
this
.
visited
++;
return
true
;
}
else
{
this
.
visited
++;
if
(
this
.
visited
>
count
)
//超过单位时间内访问次数
{
return
false
;
}
else
return
true
;
}
}
private
void
resetCount
()
{
this
.
timestamp
=
new
Date
().
getTime
();
this
.
visited
=
0
;
}
}
}
src/main/webapp/WEB-INF/lib/businessimp.jar
deleted
100644 → 0
View file @
13addc6b
File deleted
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