Re: SPI has already been started (always create new configuration instance for each starting Ignite instances) Error

2016-08-29 Thread Anand Kumar Sankaran
Hi Val

Got it.  Thanks.


On 8/29/16, 1:24 PM, "vkulichenko"  wrote:

Anand,

Copy constructor does not make a deep copy, so instances of SPIs is the
same. This is by design, because I'm not sure this is even possible in
general case (SPIs can be provided by users and in this case we know nothing
about them - sounds risky). I would not recommend to use copy constructor in
user code at all, but always construct a new instance instead.

-Val



--
View this message in context: 
https://urldefense.proofpoint.com/v2/url?u=http-3A__apache-2Dignite-2Dusers.70518.x6.nabble.com_SPI-2Dhas-2Dalready-2Dbeen-2Dstarted-2Dalways-2Dcreate-2Dnew-2Dconfiguration-2Dinstance-2Dfor-2Deach-2Dstarting-2DIgnite-2Dinstar-2Dtp7360p7385.html&d=DQICAg&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=qU_93SngJY3bPFd_cHFzZ8u3Owp9FHXx0iQE6zMz3jc&m=NxR9R85X95K_GPN2S2Tcp9z3UPm9snUYcHLszxZfss4&s=Kt_GyKHT_IY3dtLQMifmSsyD5uEiBCSJfaw9RM_6E0M&e=
 
Sent from the Apache Ignite Users mailing list archive at Nabble.com.





Re: SPI has already been started (always create new configuration instance for each starting Ignite instances) Error

2016-08-29 Thread vkulichenko
Anand,

Copy constructor does not make a deep copy, so instances of SPIs is the
same. This is by design, because I'm not sure this is even possible in
general case (SPIs can be provided by users and in this case we know nothing
about them - sounds risky). I would not recommend to use copy constructor in
user code at all, but always construct a new instance instead.

-Val



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/SPI-has-already-been-started-always-create-new-configuration-instance-for-each-starting-Ignite-instar-tp7360p7385.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: SPI has already been started (always create new configuration instance for each starting Ignite instances) Error

2016-08-29 Thread Anand Kumar Sankaran
Hi Vladislav

Thanks.  I got this to work by re-constructing the IgniteConfiguration.  
However, the Javadoc of the IgniteConfiguration copy constructor is incorrect 
or there is a bug in the copy constructor.  I will create a JIRA.

http://ignite.apache.org/releases/1.0.0/javadoc/org/apache/ignite/configuration/IgniteConfiguration.html#IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration)

--
anand

From: Vladislav Pyatkov 
Reply-To: "user@ignite.apache.org" 
Date: Monday, August 29, 2016 at 2:00 AM
To: "user@ignite.apache.org" 
Subject: Re: SPI has already been started (always create new configuration 
instance for each starting Ignite instances) Error

Hello Anand,

Ignite configuration is not reusable, because SPI stores data in internal 
fields. You can made copy of configuration before first start of Ignite 
instance.

I see a solution do it, using Spring scope bean attribute (if youuse Spring 
configuration) like this:



On Sun, Aug 28, 2016 at 7:19 PM, Anand Kumar Sankaran 
mailto:anand.sanka...@workday.com>> wrote:
Hi

I am coding a segmentation resolver that’s restarting Ignite in the case of a 
Segmentation Event.

I copy the current Ignite Configuration and use it to start a new Ignite.


this.ignite.close();

final org.apache.ignite.configuration.IgniteConfiguration copy = new 
org.apache.ignite.configuration.IgniteConfiguration(this.config);


this.ignite = Ignition.start(copy);


This still fails with the following message:

java.lang.IllegalStateException: SPI has already been started (always create 
new configuration instance for each starting Ignite instances) 
[spi=TcpCommunicationSpi 
[connectGate=org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$ConnectGateway@7106a8d2,
 
srvLsnr=org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$2@240b62af, 
locAddr=null, 
locHost=0.0.0.0/0.0.0.0<https://urldefense.proofpoint.com/v2/url?u=http-3A__0.0.0.0_0.0.0.0&d=DQMFaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=qU_93SngJY3bPFd_cHFzZ8u3Owp9FHXx0iQE6zMz3jc&m=OzHCeE6fHmkLcfV-YDXzlidXXHsqe7e-YZH1O2wOGyM&s=DvDpKrtPZ6iJAk_aKX200UfNd6wYKuHgxCQodbGSwoc&e=>,
 locPort=16500, locPortRange=50, shmemPort=-1, directBuf=true, 
directSndBuf=false, idleConnTimeout=3, connTimeout=5000, 
maxConnTimeout=60, reconCnt=10, sockSndBuf=32768, sockRcvBuf=32768, 
msgQueueLimit=1024, slowClientQueueLimit=0, nioSrvr=null, shmemSrv=null, 
tcpNoDelay=true, ackSndThreshold=16, unackedMsgsBufSize=0, 
sockWriteTimeout=2000, lsnr=null, boundTcpPort=-1, boundTcpShmemPort=-1, 
selectorsCnt=2, addrRslvr=null, rcvdMsgsCnt=103, sentMsgsCnt=105, 
rcvdBytesCnt=134129, sentBytesCnt=214242, 
ctxInitLatch=java.util.concurrent.CountDownLatch@6bc31a98[Count = 0], 
stopping=true, 
metricsLsnr=org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$3@57e640a9]]
at 
org.apache.ignite.spi.IgniteSpiAdapter.onBeforeStart(IgniteSpiAdapter.java:129)
   at 
org.apache.ignite.internal.managers.GridManagerAdapter.startSpi(GridManagerAdapter.java:217)
at 
org.apache.ignite.internal.managers.communication.GridIoManager.start(GridIoManager.java:243)
at 
org.apache.ignite.internal.IgniteKernal.startManager(IgniteKernal.java:1478)
at 
org.apache.ignite.internal.IgniteKernal.start(IgniteKernal.java:828)
at 
org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start0(IgnitionEx.java:1740)
at 
org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start(IgnitionEx.java:1590)
at 
org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.java:1043)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:570)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:517)
at org.apache.ignite.Ignition.start(Ignition.java:322)


How can I restart an Ignite with the same configuration in such a case?

--
anand



--
Vladislav Pyatkov


Re: SPI has already been started (always create new configuration instance for each starting Ignite instances) Error

2016-08-29 Thread Vladislav Pyatkov
Hello Anand,

Ignite configuration is not reusable, because SPI stores data in internal
fields. You can made copy of configuration before first start of Ignite
instance.

I see a solution do it, using Spring scope bean attribute (if youuse Spring
configuration) like this:



On Sun, Aug 28, 2016 at 7:19 PM, Anand Kumar Sankaran <
anand.sanka...@workday.com> wrote:

> Hi
>
>
>
> I am coding a segmentation resolver that’s restarting Ignite in the case
> of a Segmentation Event.
>
>
>
> I copy the current Ignite Configuration and use it to start a new Ignite.
>
>
>
> this.ignite.close();
>
>
>
> final org.apache.ignite.configuration.IgniteConfiguration copy = new
> org.apache.ignite.configuration.IgniteConfiguration(this.config);
>
>
>
> this.ignite = Ignition.*start*(copy);
>
>
>
>
>
> This still fails with the following message:
>
>
>
> java.lang.IllegalStateException: SPI has already been started (always
> create new configuration instance for each starting Ignite instances)
> [spi=TcpCommunicationSpi [connectGate=org.apache.
> ignite.spi.communication.tcp.TcpCommunicationSpi$ConnectGateway@7106a8d2,
> srvLsnr=org.apache.ignite.spi.communication.tcp.
> TcpCommunicationSpi$2@240b62af, locAddr=null, locHost=0.0.0.0/0.0.0.0,
> locPort=16500, locPortRange=50, shmemPort=-1, directBuf=true,
> directSndBuf=false, idleConnTimeout=3, connTimeout=5000,
> maxConnTimeout=60, reconCnt=10, sockSndBuf=32768, sockRcvBuf=32768,
> msgQueueLimit=1024, slowClientQueueLimit=0, nioSrvr=null, shmemSrv=null,
> tcpNoDelay=true, ackSndThreshold=16, unackedMsgsBufSize=0,
> sockWriteTimeout=2000, lsnr=null, boundTcpPort=-1, boundTcpShmemPort=-1,
> selectorsCnt=2, addrRslvr=null, rcvdMsgsCnt=103, sentMsgsCnt=105,
> rcvdBytesCnt=134129, sentBytesCnt=214242, ctxInitLatch=java.util.
> concurrent.CountDownLatch@6bc31a98[Count = 0], stopping=true,
> metricsLsnr=org.apache.ignite.spi.communication.tcp.
> TcpCommunicationSpi$3@57e640a9]]
>
> at org.apache.ignite.spi.IgniteSpiAdapter.onBeforeStart(
> IgniteSpiAdapter.java:129)
>
>at org.apache.ignite.internal.managers.GridManagerAdapter.
> startSpi(GridManagerAdapter.java:217)
>
> at org.apache.ignite.internal.managers.communication.
> GridIoManager.start(GridIoManager.java:243)
>
> at org.apache.ignite.internal.IgniteKernal.startManager(
> IgniteKernal.java:1478)
>
> at org.apache.ignite.internal.IgniteKernal.start(
> IgniteKernal.java:828)
>
> at org.apache.ignite.internal.IgnitionEx$
> IgniteNamedInstance.start0(IgnitionEx.java:1740)
>
> at org.apache.ignite.internal.IgnitionEx$
> IgniteNamedInstance.start(IgnitionEx.java:1590)
>
> at org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.
> java:1043)
>
> at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.
> java:570)
>
> at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.
> java:517)
>
> at org.apache.ignite.Ignition.start(Ignition.java:322)
>
>
>
>
>
> How can I restart an Ignite with the same configuration in such a case?
>
>
>
> --
>
> anand
>



-- 
Vladislav Pyatkov


SPI has already been started (always create new configuration instance for each starting Ignite instances) Error

2016-08-28 Thread Anand Kumar Sankaran
Hi

I am coding a segmentation resolver that’s restarting Ignite in the case of a 
Segmentation Event.

I copy the current Ignite Configuration and use it to start a new Ignite.


this.ignite.close();

final org.apache.ignite.configuration.IgniteConfiguration copy = new 
org.apache.ignite.configuration.IgniteConfiguration(this.config);


this.ignite = Ignition.start(copy);


This still fails with the following message:

java.lang.IllegalStateException: SPI has already been started (always create 
new configuration instance for each starting Ignite instances) 
[spi=TcpCommunicationSpi 
[connectGate=org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$ConnectGateway@7106a8d2,
 
srvLsnr=org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$2@240b62af, 
locAddr=null, locHost=0.0.0.0/0.0.0.0, locPort=16500, locPortRange=50, 
shmemPort=-1, directBuf=true, directSndBuf=false, idleConnTimeout=3, 
connTimeout=5000, maxConnTimeout=60, reconCnt=10, sockSndBuf=32768, 
sockRcvBuf=32768, msgQueueLimit=1024, slowClientQueueLimit=0, nioSrvr=null, 
shmemSrv=null, tcpNoDelay=true, ackSndThreshold=16, unackedMsgsBufSize=0, 
sockWriteTimeout=2000, lsnr=null, boundTcpPort=-1, boundTcpShmemPort=-1, 
selectorsCnt=2, addrRslvr=null, rcvdMsgsCnt=103, sentMsgsCnt=105, 
rcvdBytesCnt=134129, sentBytesCnt=214242, 
ctxInitLatch=java.util.concurrent.CountDownLatch@6bc31a98[Count = 0], 
stopping=true, 
metricsLsnr=org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$3@57e640a9]]
at 
org.apache.ignite.spi.IgniteSpiAdapter.onBeforeStart(IgniteSpiAdapter.java:129)
   at 
org.apache.ignite.internal.managers.GridManagerAdapter.startSpi(GridManagerAdapter.java:217)
at 
org.apache.ignite.internal.managers.communication.GridIoManager.start(GridIoManager.java:243)
at 
org.apache.ignite.internal.IgniteKernal.startManager(IgniteKernal.java:1478)
at 
org.apache.ignite.internal.IgniteKernal.start(IgniteKernal.java:828)
at 
org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start0(IgnitionEx.java:1740)
at 
org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start(IgnitionEx.java:1590)
at 
org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.java:1043)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:570)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:517)
at org.apache.ignite.Ignition.start(Ignition.java:322)


How can I restart an Ignite with the same configuration in such a case?

--
anand