Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
b3fc1452
Commit
b3fc1452
authored
Sep 08, 2009
by
malosek
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git@github.com:sustrik/zeromq2
parents
2a4a10c8
3069b6bd
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
374 additions
and
140 deletions
+374
-140
Context.cpp
java/Context.cpp
+7
-0
Message.cpp
java/Message.cpp
+0
-138
Socket.cpp
java/Socket.cpp
+7
-0
Socket.java
java/org/zmq/Socket.java
+1
-1
j_local_lat.vcproj
msvc/j_local_lat/j_local_lat.vcproj
+78
-0
j_local_thr.vcproj
msvc/j_local_thr/j_local_thr.vcproj
+78
-0
j_remote_lat.vcproj
msvc/j_remote_lat/j_remote_lat.vcproj
+78
-0
j_remote_thr.vcproj
msvc/j_remote_thr/j_remote_thr.vcproj
+78
-0
msvc.sln
msvc/msvc.sln
+45
-0
local_thr.c
perf/c/local_thr.c
+2
-1
No files found.
java/Context.cpp
View file @
b3fc1452
...
...
@@ -34,7 +34,14 @@ static void raise_exception (JNIEnv *env, int err)
assert
(
exception_class
);
// Get text description of the exception.
#if defined _MSC_VER
#pragma warning (push)
#pragma warning (disable:4996)
#endif
const
char
*
err_msg
=
strerror
(
err
);
#if defined _MSC_VER
#pragma warning (pop)
#endif
// Raise the exception.
int
rc
=
env
->
ThrowNew
(
exception_class
,
err_msg
);
...
...
java/Message.cpp
deleted
100644 → 0
View file @
2a4a10c8
/*
Copyright (c) 2007-2009 FastMQ Inc.
This file is part of 0MQ.
0MQ is free software; you can redistribute it and/or modify it under
the terms of the Lesser GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
0MQ 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
Lesser GNU General Public License for more details.
You should have received a copy of the Lesser GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include "zmq.h"
#include "org_zmq_Message.h"
static
jfieldID
msg_handle_fid
=
NULL
;
static
void
raise_exception
(
JNIEnv
*
env
,
int
err
)
{
// Get exception class.
jclass
exception_class
=
env
->
FindClass
(
"java/lang/Exception"
);
assert
(
exception_class
);
// Get text description of the exception.
const
char
*
err_msg
=
strerror
(
err
);
// Raise the exception.
int
rc
=
env
->
ThrowNew
(
exception_class
,
err_msg
);
assert
(
rc
==
0
);
// Free the local ref.
env
->
DeleteLocalRef
(
exception_class
);
}
JNIEXPORT
void
JNICALL
Java_org_zmq_Message_construct
(
JNIEnv
*
env
,
jobject
obj
)
{
if
(
msg_handle_fid
==
NULL
)
{
jclass
cls
=
env
->
GetObjectClass
(
obj
);
assert
(
cls
!=
NULL
);
msg_handle_fid
=
env
->
GetFieldID
(
cls
,
"msgHandle"
,
"J"
);
assert
(
msg_handle_fid
!=
NULL
);
env
->
DeleteLocalRef
(
cls
);
}
zmq_msg_t
*
msg
=
(
zmq_msg_t
*
)
malloc
(
sizeof
(
zmq_msg_t
));
if
(
msg
==
NULL
)
{
raise_exception
(
env
,
ENOMEM
);
return
;
}
int
rc
=
zmq_msg_init
(
msg
);
assert
(
rc
==
0
);
env
->
SetLongField
(
obj
,
msg_handle_fid
,
(
jlong
)
msg
);
}
JNIEXPORT
void
JNICALL
Java_org_zmq_Message_constructWithData
(
JNIEnv
*
env
,
jobject
obj
,
jbyteArray
payload
)
{
if
(
msg_handle_fid
==
NULL
)
{
jclass
cls
=
env
->
GetObjectClass
(
obj
);
assert
(
cls
!=
NULL
);
msg_handle_fid
=
env
->
GetFieldID
(
cls
,
"msgHandle"
,
"J"
);
assert
(
msg_handle_fid
!=
NULL
);
env
->
DeleteLocalRef
(
cls
);
}
zmq_msg_t
*
msg
=
(
zmq_msg_t
*
)
malloc
(
sizeof
(
zmq_msg_t
));
if
(
msg
==
NULL
)
{
raise_exception
(
env
,
ENOMEM
);
return
;
}
jsize
array_size
=
env
->
GetArrayLength
(
payload
);
jbyte
*
array_data
=
env
->
GetByteArrayElements
(
payload
,
NULL
);
int
rc
=
zmq_msg_init_size
(
msg
,
array_size
);
assert
(
rc
==
0
);
memcpy
(
zmq_msg_data
(
msg
),
array_data
,
array_size
);
env
->
ReleaseByteArrayElements
(
payload
,
array_data
,
JNI_ABORT
);
env
->
SetLongField
(
obj
,
msg_handle_fid
,
(
jlong
)
msg
);
}
JNIEXPORT
void
JNICALL
Java_org_zmq_Message_finalize
(
JNIEnv
*
env
,
jobject
obj
)
{
zmq_msg_t
*
msg
=
(
zmq_msg_t
*
)
env
->
GetLongField
(
obj
,
msg_handle_fid
);
assert
(
msg
);
int
rc
=
zmq_msg_close
(
msg
);
assert
(
rc
==
0
);
free
(
msg
);
}
JNIEXPORT
jbyteArray
JNICALL
Java_org_zmq_Message_getMsgPayload
(
JNIEnv
*
env
,
jobject
obj
)
{
zmq_msg_t
*
msg
=
(
zmq_msg_t
*
)
env
->
GetLongField
(
obj
,
msg_handle_fid
);
assert
(
msg
);
jsize
msg_size
=
zmq_msg_size
(
msg
);
jbyte
*
msg_data
=
(
jbyte
*
)
zmq_msg_data
(
msg
);
jbyteArray
payload
=
env
->
NewByteArray
(
msg_size
);
if
(
payload
==
NULL
)
return
NULL
;
env
->
SetByteArrayRegion
(
payload
,
0
,
msg_size
,
msg_data
);
assert
(
!
env
->
ExceptionCheck
());
return
payload
;
}
JNIEXPORT
jint
JNICALL
Java_org_zmq_Message_getMsgType
(
JNIEnv
*
env
,
jobject
obj
)
{
zmq_msg_t
*
msg
=
(
zmq_msg_t
*
)
env
->
GetLongField
(
obj
,
msg_handle_fid
);
assert
(
msg
);
return
(
jint
)
zmq_msg_type
(
msg
);
}
java/Socket.cpp
View file @
b3fc1452
...
...
@@ -35,7 +35,14 @@ static void raise_exception (JNIEnv *env, int err)
assert
(
exception_class
);
// Get text description of the exception.
#if defined _MSC_VER
#pragma warning (push)
#pragma warning (disable:4996)
#endif
const
char
*
err_msg
=
strerror
(
err
);
#if defined _MSC_VER
#pragma warning (pop)
#endif
// Raise the exception.
int
rc
=
env
->
ThrowNew
(
exception_class
,
err_msg
);
...
...
java/org/zmq/Socket.java
View file @
b3fc1452
/*
/*
Copyright (c) 2007-2009 FastMQ Inc.
This file is part of 0MQ.
...
...
msvc/j_local_lat/j_local_lat.vcproj
0 → 100644
View file @
b3fc1452
<?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType=
"Visual C++"
Version=
"9.00"
Name=
"j_local_lat"
ProjectGUID=
"{F4D93BC6-9D70-4113-94A8-817A52B49290}"
RootNamespace=
"j_local_lat"
TargetFrameworkVersion=
"196613"
>
<Platforms>
<Platform
Name=
"Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name=
"Debug|Win32"
OutputDirectory=
"$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory=
"$(ConfigurationName)"
ConfigurationType=
"10"
CharacterSet=
"2"
>
<Tool
Name=
"VCPreBuildEventTool"
Description=
"Compiling Java classes"
CommandLine=
"javac -classpath ..\..\java ..\..\perf\java\local_lat.java"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCMIDLTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name=
"Release|Win32"
OutputDirectory=
"$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory=
"$(ConfigurationName)"
ConfigurationType=
"10"
CharacterSet=
"2"
WholeProgramOptimization=
"1"
>
<Tool
Name=
"VCPreBuildEventTool"
Description=
"Compiling Java classes"
CommandLine=
"javac -classpath ..\..\java ..\..\perf\java\local_lat.java"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCMIDLTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name=
"Java Files"
>
<File
RelativePath=
"..\..\perf\java\local_lat.java"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
msvc/j_local_thr/j_local_thr.vcproj
0 → 100644
View file @
b3fc1452
<?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType=
"Visual C++"
Version=
"9.00"
Name=
"j_local_thr"
ProjectGUID=
"{95E6161D-418B-4ABF-85E2-F07797742156}"
RootNamespace=
"j_local_thr"
TargetFrameworkVersion=
"196613"
>
<Platforms>
<Platform
Name=
"Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name=
"Debug|Win32"
OutputDirectory=
"$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory=
"$(ConfigurationName)"
ConfigurationType=
"10"
CharacterSet=
"2"
>
<Tool
Name=
"VCPreBuildEventTool"
Description=
"Compiling Java classes"
CommandLine=
"javac -classpath ..\..\java ..\..\perf\java\local_thr.java"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCMIDLTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name=
"Release|Win32"
OutputDirectory=
"$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory=
"$(ConfigurationName)"
ConfigurationType=
"10"
CharacterSet=
"2"
WholeProgramOptimization=
"1"
>
<Tool
Name=
"VCPreBuildEventTool"
Description=
"Compiling Java classes"
CommandLine=
"javac -classpath ..\..\java ..\..\perf\java\local_thr.java"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCMIDLTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name=
"Java Files"
>
<File
RelativePath=
"..\..\perf\java\local_thr.java"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
msvc/j_remote_lat/j_remote_lat.vcproj
0 → 100644
View file @
b3fc1452
<?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType=
"Visual C++"
Version=
"9.00"
Name=
"j_remote_lat"
ProjectGUID=
"{15C832D0-2E68-484A-9DCE-BC872FE1C7EF}"
RootNamespace=
"j_remote_lat"
TargetFrameworkVersion=
"196613"
>
<Platforms>
<Platform
Name=
"Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name=
"Debug|Win32"
OutputDirectory=
"$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory=
"$(ConfigurationName)"
ConfigurationType=
"10"
CharacterSet=
"2"
>
<Tool
Name=
"VCPreBuildEventTool"
Description=
"Compiling Java classes"
CommandLine=
"javac -classpath ..\..\java ..\..\perf\java\remote_lat.java"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCMIDLTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name=
"Release|Win32"
OutputDirectory=
"$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory=
"$(ConfigurationName)"
ConfigurationType=
"10"
CharacterSet=
"2"
WholeProgramOptimization=
"1"
>
<Tool
Name=
"VCPreBuildEventTool"
Description=
"Compiling Java classes"
CommandLine=
"javac -classpath ..\..\java ..\..\perf\java\remote_lat.java"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCMIDLTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name=
"Java Files"
>
<File
RelativePath=
"..\..\perf\java\remote_lat.java"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
msvc/j_remote_thr/j_remote_thr.vcproj
0 → 100644
View file @
b3fc1452
<?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType=
"Visual C++"
Version=
"9.00"
Name=
"j_remote_thr"
ProjectGUID=
"{00A421BA-3B6B-45BD-B91F-DED953472622}"
RootNamespace=
"j_remote_thr"
TargetFrameworkVersion=
"196613"
>
<Platforms>
<Platform
Name=
"Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name=
"Debug|Win32"
OutputDirectory=
"$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory=
"$(ConfigurationName)"
ConfigurationType=
"10"
CharacterSet=
"2"
>
<Tool
Name=
"VCPreBuildEventTool"
Description=
"Compiling Java classes"
CommandLine=
"javac -classpath ..\..\java ..\..\perf\java\remote_thr.java"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCMIDLTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name=
"Release|Win32"
OutputDirectory=
"$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory=
"$(ConfigurationName)"
ConfigurationType=
"10"
CharacterSet=
"2"
WholeProgramOptimization=
"1"
>
<Tool
Name=
"VCPreBuildEventTool"
Description=
"Compiling Java classes"
CommandLine=
"javac -classpath ..\..\java ..\..\perf\java\remote_thr.java"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCMIDLTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name=
"Java Files"
>
<File
RelativePath=
"..\..\perf\java\remote_thr.java"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
msvc/msvc.sln
View file @
b3fc1452
...
...
@@ -43,6 +43,31 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp_remote_thr", "cpp_remot
{641C5F36-32EE-4323-B740-992B651CF9D6} = {641C5F36-32EE-4323-B740-992B651CF9D6}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "java", "java\java.vcproj", "{66C40C34-7E05-4B03-8027-F40850C01364}"
ProjectSection(ProjectDependencies) = postProject
{641C5F36-32EE-4323-B740-992B651CF9D6} = {641C5F36-32EE-4323-B740-992B651CF9D6}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "j_local_lat", "j_local_lat\j_local_lat.vcproj", "{F4D93BC6-9D70-4113-94A8-817A52B49290}"
ProjectSection(ProjectDependencies) = postProject
{66C40C34-7E05-4B03-8027-F40850C01364} = {66C40C34-7E05-4B03-8027-F40850C01364}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "j_remote_lat", "j_remote_lat\j_remote_lat.vcproj", "{15C832D0-2E68-484A-9DCE-BC872FE1C7EF}"
ProjectSection(ProjectDependencies) = postProject
{66C40C34-7E05-4B03-8027-F40850C01364} = {66C40C34-7E05-4B03-8027-F40850C01364}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "j_local_thr", "j_local_thr\j_local_thr.vcproj", "{95E6161D-418B-4ABF-85E2-F07797742156}"
ProjectSection(ProjectDependencies) = postProject
{66C40C34-7E05-4B03-8027-F40850C01364} = {66C40C34-7E05-4B03-8027-F40850C01364}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "j_remote_thr", "j_remote_thr\j_remote_thr.vcproj", "{00A421BA-3B6B-45BD-B91F-DED953472622}"
ProjectSection(ProjectDependencies) = postProject
{66C40C34-7E05-4B03-8027-F40850C01364} = {66C40C34-7E05-4B03-8027-F40850C01364}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
...
...
@@ -85,6 +110,26 @@ Global
{EB051624-35C2-4B51-B5DD-8734372617A7}.Debug|Win32.Build.0 = Debug|Win32
{EB051624-35C2-4B51-B5DD-8734372617A7}.Release|Win32.ActiveCfg = Release|Win32
{EB051624-35C2-4B51-B5DD-8734372617A7}.Release|Win32.Build.0 = Release|Win32
{66C40C34-7E05-4B03-8027-F40850C01364}.Debug|Win32.ActiveCfg = Debug|Win32
{66C40C34-7E05-4B03-8027-F40850C01364}.Debug|Win32.Build.0 = Debug|Win32
{66C40C34-7E05-4B03-8027-F40850C01364}.Release|Win32.ActiveCfg = Release|Win32
{66C40C34-7E05-4B03-8027-F40850C01364}.Release|Win32.Build.0 = Release|Win32
{F4D93BC6-9D70-4113-94A8-817A52B49290}.Debug|Win32.ActiveCfg = Debug|Win32
{F4D93BC6-9D70-4113-94A8-817A52B49290}.Debug|Win32.Build.0 = Debug|Win32
{F4D93BC6-9D70-4113-94A8-817A52B49290}.Release|Win32.ActiveCfg = Release|Win32
{F4D93BC6-9D70-4113-94A8-817A52B49290}.Release|Win32.Build.0 = Release|Win32
{15C832D0-2E68-484A-9DCE-BC872FE1C7EF}.Debug|Win32.ActiveCfg = Debug|Win32
{15C832D0-2E68-484A-9DCE-BC872FE1C7EF}.Debug|Win32.Build.0 = Debug|Win32
{15C832D0-2E68-484A-9DCE-BC872FE1C7EF}.Release|Win32.ActiveCfg = Release|Win32
{15C832D0-2E68-484A-9DCE-BC872FE1C7EF}.Release|Win32.Build.0 = Release|Win32
{95E6161D-418B-4ABF-85E2-F07797742156}.Debug|Win32.ActiveCfg = Debug|Win32
{95E6161D-418B-4ABF-85E2-F07797742156}.Debug|Win32.Build.0 = Debug|Win32
{95E6161D-418B-4ABF-85E2-F07797742156}.Release|Win32.ActiveCfg = Release|Win32
{95E6161D-418B-4ABF-85E2-F07797742156}.Release|Win32.Build.0 = Release|Win32
{00A421BA-3B6B-45BD-B91F-DED953472622}.Debug|Win32.ActiveCfg = Debug|Win32
{00A421BA-3B6B-45BD-B91F-DED953472622}.Debug|Win32.Build.0 = Debug|Win32
{00A421BA-3B6B-45BD-B91F-DED953472622}.Release|Win32.ActiveCfg = Release|Win32
{00A421BA-3B6B-45BD-B91F-DED953472622}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
...
...
perf/c/local_thr.c
View file @
b3fc1452
...
...
@@ -73,7 +73,8 @@ int main (int argc, char *argv [])
if
(
elapsed
==
0
)
elapsed
=
1
;
throughput
=
(
double
)
message_count
/
(
double
)
elapsed
*
1000000
;
throughput
=
(
unsigned
long
)
((
double
)
message_count
/
(
double
)
elapsed
*
1000000
);
megabits
=
(
double
)
(
throughput
*
message_size
*
8
)
/
1000000
;
printf
(
"message size: %d [B]
\n
"
,
(
int
)
message_size
);
...
...
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