Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Akka-Performancetest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christian Wulf
Akka-Performancetest
Commits
a65bedbc
Commit
a65bedbc
authored
10 years ago
by
Christian Wulf
Browse files
Options
Downloads
Patches
Plain Diff
fixed underflow issue
parent
1f1319b9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/teetime/util/TcpReader.java
+24
-4
24 additions, 4 deletions
src/main/java/teetime/util/TcpReader.java
with
24 additions
and
4 deletions
src/main/java/teetime/util/TcpReader.java
+
24
−
4
View file @
a65bedbc
...
@@ -26,9 +26,11 @@ import java.nio.channels.SocketChannel;
...
@@ -26,9 +26,11 @@ import java.nio.channels.SocketChannel;
import
kieker.common.exception.RecordInstantiationException
;
import
kieker.common.exception.RecordInstantiationException
;
import
kieker.common.logging.Log
;
import
kieker.common.logging.Log
;
import
kieker.common.logging.LogFactory
;
import
kieker.common.logging.LogFactory
;
import
kieker.common.record.AbstractMonitoringRecord
;
import
kieker.common.record.IMonitoringRecord
;
import
kieker.common.record.IMonitoringRecord
;
import
kieker.common.record.factory.CachedRecordFactoryCatalog
;
import
kieker.common.record.factory.CachedRecordFactoryCatalog
;
import
kieker.common.record.factory.IRecordFactory
;
import
kieker.common.record.factory.IRecordFactory
;
import
kieker.common.record.factory.old.RecordFactoryWrapper
;
import
kieker.common.record.misc.RegistryRecord
;
import
kieker.common.record.misc.RegistryRecord
;
import
kieker.common.util.registry.ILookup
;
import
kieker.common.util.registry.ILookup
;
import
kieker.common.util.registry.Lookup
;
import
kieker.common.util.registry.Lookup
;
...
@@ -47,6 +49,9 @@ import teetime.stage.io.AbstractTcpReader;
...
@@ -47,6 +49,9 @@ import teetime.stage.io.AbstractTcpReader;
public
class
TcpReader
extends
AbstractTcpReader
<
IMonitoringRecord
>
{
public
class
TcpReader
extends
AbstractTcpReader
<
IMonitoringRecord
>
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
TcpReader
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
TcpReader
.
class
);
private
static
final
int
INT_BYTES
=
AbstractMonitoringRecord
.
TYPE_SIZE_INT
;
private
static
final
int
LONG_BYTES
=
AbstractMonitoringRecord
.
TYPE_SIZE_LONG
;
private
static
final
int
UNKNOWN_SIZE
=
RecordFactoryWrapper
.
UNKNOWN_SIZE
;
private
final
CachedRecordFactoryCatalog
recordFactories
=
CachedRecordFactoryCatalog
.
getInstance
();
private
final
CachedRecordFactoryCatalog
recordFactories
=
CachedRecordFactoryCatalog
.
getInstance
();
// BETTER use a non thread-safe implementation to increase performance. A thread-safe version is not necessary.
// BETTER use a non thread-safe implementation to increase performance. A thread-safe version is not necessary.
...
@@ -87,18 +92,33 @@ public class TcpReader extends AbstractTcpReader<IMonitoringRecord> {
...
@@ -87,18 +92,33 @@ public class TcpReader extends AbstractTcpReader<IMonitoringRecord> {
@Override
@Override
protected
final
boolean
read
(
final
ByteBuffer
buffer
)
{
protected
final
boolean
read
(
final
ByteBuffer
buffer
)
{
// identify record class
if
(
buffer
.
remaining
()
<
INT_BYTES
)
{
return
false
;
}
final
int
clazzId
=
buffer
.
getInt
();
final
int
clazzId
=
buffer
.
getInt
();
final
String
recordClassName
=
this
.
stringRegistry
.
get
(
clazzId
);
// identify logging timestamp
if
(
buffer
.
remaining
()
<
LONG_BYTES
)
{
return
false
;
}
final
long
loggingTimestamp
=
buffer
.
getLong
();
final
long
loggingTimestamp
=
buffer
.
getLong
();
final
String
recordClassName
=
this
.
stringRegistry
.
get
(
clazzId
);
// identify record data
final
IRecordFactory
<?
extends
IMonitoringRecord
>
recordFactory
=
this
.
recordFactories
.
get
(
recordClassName
);
int
recordSizeInBytes
=
recordFactory
.
getRecordSizeInBytes
();
if
(
recordSizeInBytes
!=
UNKNOWN_SIZE
&&
buffer
.
remaining
()
<
recordSizeInBytes
)
{
return
false
;
}
try
{
try
{
final
IRecordFactory
<?
extends
IMonitoringRecord
>
recordFactory
=
this
.
recordFactories
.
get
(
recordClassName
);
final
IMonitoringRecord
record
=
recordFactory
.
create
(
buffer
,
this
.
stringRegistry
);
IMonitoringRecord
record
=
recordFactory
.
create
(
buffer
,
this
.
stringRegistry
);
record
.
setLoggingTimestamp
(
loggingTimestamp
);
record
.
setLoggingTimestamp
(
loggingTimestamp
);
send
(
record
);
send
(
record
);
}
catch
(
final
RecordInstantiationException
ex
)
{
}
catch
(
final
RecordInstantiationException
ex
)
{
super
.
logger
.
error
(
"Failed to create record
:"
,
ex
);
super
.
logger
.
error
(
"Failed to create
: "
+
record
ClassName
,
ex
);
}
}
return
true
;
return
true
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment