Re: How to enable JNA for Cassandra on Windows?

2011-09-23 Thread Jonathan Ellis
mmap is supported by the JDK, jna is not required.

On Fri, Sep 23, 2011 at 5:07 AM, Viktor Jevdokimov <
viktor.jevdoki...@adform.com> wrote:

> I found that there‘s no C library under Windows, and msvcrt does not
> provide mlockall function, so currently there‘s no way to use JNA under
> Windows. That way mmap is not a good idea?
>
> ** **
>
> ** **
> **
>
> ** **
>
> Best regards/ Pagarbiai
>
> ** **
>
> *Viktor Jevdokimov*
>
> Senior Developer
>
> ** **
>
> Email:  viktor.jevdoki...@adform.com
>
> Phone: +370 5 212 3063. Fax: +370 5 261 0453
>
> J. Jasinskio 16C, LT-01112 Vilnius, Lithuania
>
> ** **
>
> ** **
>
> [image: Adform news] <http://www.adform.com/>
>
> [image: Visit us!]
>
>   Follow:
>
> [image: twitter] <http://twitter.com/#%21/adforminsider>
>
> Visit our blog <http://www.adform.com/site/blog>
>
> Disclaimer: The information contained in this message and attachments is
> intended solely for the attention and use of the named addressee and may be
> confidential. If you are not the intended recipient, you are reminded that
> the information remains the property of the sender. You must not use,
> disclose, distribute, copy, print or rely on this e-mail. If you have
> received this message in error, please contact the sender immediately and
> irrevocably delete this message and any copies.****
>
> *From:* Viktor Jevdokimov [mailto:vjevdoki...@gmail.com]
> *Sent:* Thursday, September 22, 2011 15:01
> *To:* user@cassandra.apache.org
> *Subject:* How to enable JNA for Cassandra on Windows?
>
> ** **
>
> Hi,
>
> ** **
>
> I'm trying without success to enable JNA for Cassandra on Windows.
>
> ** **
>
> Tried to place JNA 3.3.0 libs jna.jar and platform.jar into Cassandra 0.8.6
> lib dir, but getting in log:
>
> Unable to link C library. Native methods will be disabled.
>
> ** **
>
> What is missed or what is wrong?
>
> ** **
>
> One thing I've found on inet about JNA and Windows is this sample:
>
> ** **
>
> // Library is c for unix and msvcrt for windows
>
> String libName = "c";
> if (System.getProperty("os.name").contains("Windows"))
> {
>   libName = "msvcrt";
>
> 
>
> }
>
> 
>
> // Loading dynamically the library
> CInterface demo = (CInterface) Native.loadLibrary(libName, CInterface.class); 
> 
>
> ** **
>
> from http://www.scriptol.com/programming/jna.php
>
> ** **
>
> while in Cassandra:
>
> ** **
>
> try
>
> {
>
> Native.register("c");
>
> }
>
> catch (NoClassDefFoundError e)
>
> {
>
> logger.info("JNA not found. Native methods will be disabled.");
>
> }
>
> catch (UnsatisfiedLinkError e)
>
> {
>
> logger.info("Unable to link C library. Native methods will be 
> disabled.");
>
> }
>
> catch (NoSuchMethodError e)
>
> {
>
> logger.warn("Obsolete version of JNA present; unable to register C 
> library. Upgrade to JNA 3.2.7 or later");
>
> }
>
> ** **
>
> Is it true that for Windows Cassandra should do something like:
>
> ** **
>
> if (System.getProperty("os.name").contains("Windows"))
>
> {
> Native.register("msvcrt");
> }
>
> else
>
> {
>
> Native.register("c");
> }
>
> ** **
>
> ** **
>
> Thanks
>
> Viktor
>



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com
<><><>

RE: How to enable JNA for Cassandra on Windows?

2011-09-23 Thread Viktor Jevdokimov
I found that there's no C library under Windows, and msvcrt does not provide 
mlockall function, so currently there's no way to use JNA under Windows. That 
way mmap is not a good idea?





Best regards/ Pagarbiai



Viktor Jevdokimov

Senior Developer



Email:  viktor.jevdoki...@adform.com

Phone: +370 5 212 3063. Fax: +370 5 261 0453

J. Jasinskio 16C, LT-01112 Vilnius, Lithuania






[cid:signature-logo3d60.png]<http://www.adform.com/>

[cid:dm-exco6cf8.png]

Follow:


[cid:tweet5595.png]<http://twitter.com/#!/adforminsider>

Visit our blog<http://www.adform.com/site/blog>



Disclaimer: The information contained in this message and attachments is 
intended solely for the attention and use of the named addressee and may be 
confidential. If you are not the intended recipient, you are reminded that the 
information remains the property of the sender. You must not use, disclose, 
distribute, copy, print or rely on this e-mail. If you have received this 
message in error, please contact the sender immediately and irrevocably delete 
this message and any copies.

From: Viktor Jevdokimov [mailto:vjevdoki...@gmail.com]
Sent: Thursday, September 22, 2011 15:01
To: user@cassandra.apache.org
Subject: How to enable JNA for Cassandra on Windows?

Hi,

I'm trying without success to enable JNA for Cassandra on Windows.

Tried to place JNA 3.3.0 libs jna.jar and platform.jar into Cassandra 0.8.6 lib 
dir, but getting in log:
Unable to link C library. Native methods will be disabled.

What is missed or what is wrong?

One thing I've found on inet about JNA and Windows is this sample:



// Library is c for unix and msvcrt for windows
String libName = "c";
if (System.getProperty("os.name<http://os.name>").contains("Windows"))
{
  libName = "msvcrt";


}


// Loading dynamically the library
CInterface demo = (CInterface) Native.loadLibrary(libName, CInterface.class);

from http://www.scriptol.com/programming/jna.php

while in Cassandra:



try

{

Native.register("c");

}

catch (NoClassDefFoundError e)

{

logger.info<http://logger.info>("JNA not found. Native methods will be 
disabled.");

}

catch (UnsatisfiedLinkError e)

{

logger.info<http://logger.info>("Unable to link C library. Native 
methods will be disabled.");

}

catch (NoSuchMethodError e)

{

logger.warn("Obsolete version of JNA present; unable to register C 
library. Upgrade to JNA 3.2.7 or later");

}

Is it true that for Windows Cassandra should do something like:



if (System.getProperty("os.name<http://os.name>").contains("Windows"))
{
Native.register("msvcrt");
}

else

{

Native.register("c");
}


Thanks
Viktor
<><><>

How to enable JNA for Cassandra on Windows?

2011-09-22 Thread Viktor Jevdokimov
Hi,

I'm trying without success to enable JNA for Cassandra on Windows.

Tried to place JNA 3.3.0 libs jna.jar and platform.jar into Cassandra 0.8.6
lib dir, but getting in log:
Unable to link C library. Native methods will be disabled.

What is missed or what is wrong?

One thing I've found on inet about JNA and Windows is this sample:

// Library is c for unix and msvcrt for windows
String libName = "c";
if (System.getProperty("os.name").contains("Windows"))
{
  libName = "msvcrt";
}

// Loading dynamically the library
CInterface demo = (CInterface) Native.loadLibrary(libName, CInterface.class);


from http://www.scriptol.com/programming/jna.php

while in Cassandra:

try
{
Native.register("c");
}
catch (NoClassDefFoundError e)
{
logger.info("JNA not found. Native methods will be disabled.");
}
catch (UnsatisfiedLinkError e)
{
logger.info("Unable to link C library. Native methods will be
disabled.");
}
catch (NoSuchMethodError e)
{
logger.warn("Obsolete version of JNA present; unable to
register C library. Upgrade to JNA 3.2.7 or later");
}


Is it true that for Windows Cassandra should do something like:

if (System.getProperty("os.name").contains("Windows"))
{
Native.register("msvcrt");
}
else
{
Native.register("c");
}



Thanks
Viktor