You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2023/06/19 16:57:00 UTC

[plc4x] branch develop updated (0458529ee1 -> 5894b08ef7)

This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


    from 0458529ee1 fix(plc4go/spi): fix race issues in request transaction
     new 405c8f83ed feat(plc4go/bacnet): update vendor
     new 9fe80f9cfe feat(plc4go/knx): update vendor
     new 50184f6747 feat(plc4j/knx): update vendor
     new fa268e8586 feat(plc4j/bacnet): update vendor
     new 5894b08ef7 fix(plc4go/spi): fix concurrency issue when a executor is being started and stopped pretty fast

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 plc4go/internal/cbus/CBusMessageMapper_test.go     | 181 +++++++++++++--------
 .../bacnetip/readwrite/model/BACnetVendorId.go     |  48 ++++++
 .../knxnetip/readwrite/model/KnxManufacturer.go    |  42 ++++-
 plc4go/spi/pool/executor.go                        |   2 +
 plc4go/spi/pool/worker.go                          |  15 +-
 plc4go/spi/pool/worker_test.go                     |  51 ++++--
 .../java/bacnetip/readwrite/BACnetVendorId.java    |   4 +
 .../java/knxnetip/readwrite/KnxManufacturer.java   |   6 +-
 8 files changed, 260 insertions(+), 89 deletions(-)


[plc4x] 05/05: fix(plc4go/spi): fix concurrency issue when a executor is being started and stopped pretty fast

Posted by sr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 5894b08ef7b7040de580e0011a5ef7e891597487
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Mon Jun 19 18:56:51 2023 +0200

    fix(plc4go/spi): fix concurrency issue when a executor is being started and stopped pretty fast
---
 plc4go/internal/cbus/CBusMessageMapper_test.go | 181 +++++++++++++++----------
 plc4go/spi/pool/executor.go                    |   2 +
 plc4go/spi/pool/worker.go                      |  15 +-
 plc4go/spi/pool/worker_test.go                 |  51 +++++--
 4 files changed, 167 insertions(+), 82 deletions(-)

diff --git a/plc4go/internal/cbus/CBusMessageMapper_test.go b/plc4go/internal/cbus/CBusMessageMapper_test.go
index 588ba63d81..0857832a47 100644
--- a/plc4go/internal/cbus/CBusMessageMapper_test.go
+++ b/plc4go/internal/cbus/CBusMessageMapper_test.go
@@ -21,17 +21,18 @@ package cbus
 
 import (
 	"fmt"
+	"testing"
+
 	apiModel "github.com/apache/plc4x/plc4go/pkg/api/model"
 	apiValues "github.com/apache/plc4x/plc4go/pkg/api/values"
 	readWriteModel "github.com/apache/plc4x/plc4go/protocols/cbus/readwrite/model"
-	"github.com/apache/plc4x/plc4go/spi/options"
 	"github.com/apache/plc4x/plc4go/spi/pool"
 	"github.com/apache/plc4x/plc4go/spi/testutils"
 	"github.com/apache/plc4x/plc4go/spi/transactions"
 	"github.com/apache/plc4x/plc4go/spi/utils"
 	spiValues "github.com/apache/plc4x/plc4go/spi/values"
+
 	"github.com/stretchr/testify/assert"
-	"testing"
 )
 
 func TestTagToCBusMessage(t *testing.T) {
@@ -1468,12 +1469,14 @@ func TestMapEncodedReply(t *testing.T) {
 				},
 			},
 			setup: func(t *testing.T, args *args) {
-				executor := pool.NewFixedSizeExecutor(10, 50, options.WithCustomLogger(testutils.ProduceTestingLogger(t)))
+				_options := testutils.EnrichOptionsWithOptionsForTesting(t)
+				executor := pool.NewFixedSizeExecutor(10, 50, _options...)
 				executor.Start()
 				transactionManager := transactions.NewRequestTransactionManager(
 					1,
-					options.WithCustomLogger(testutils.ProduceTestingLogger(t)),
-					transactions.WithCustomExecutor(executor),
+					append(_options,
+						transactions.WithCustomExecutor(executor),
+					)...,
 				)
 				t.Cleanup(func() {
 					assert.NoError(t, transactionManager.Close())
@@ -1540,12 +1543,14 @@ func TestMapEncodedReply(t *testing.T) {
 				},
 			},
 			setup: func(t *testing.T, args *args) {
-				executor := pool.NewFixedSizeExecutor(10, 50, options.WithCustomLogger(testutils.ProduceTestingLogger(t)))
+				_options := testutils.EnrichOptionsWithOptionsForTesting(t)
+				executor := pool.NewFixedSizeExecutor(10, 50, _options...)
 				executor.Start()
 				transactionManager := transactions.NewRequestTransactionManager(
 					1,
-					options.WithCustomLogger(testutils.ProduceTestingLogger(t)),
-					transactions.WithCustomExecutor(executor),
+					append(_options,
+						transactions.WithCustomExecutor(executor),
+					)...,
 				)
 				t.Cleanup(func() {
 					assert.NoError(t, transactionManager.Close())
@@ -1614,12 +1619,14 @@ func TestMapEncodedReply(t *testing.T) {
 				},
 			},
 			setup: func(t *testing.T, args *args) {
-				executor := pool.NewFixedSizeExecutor(10, 50, options.WithCustomLogger(testutils.ProduceTestingLogger(t)))
+				_options := testutils.EnrichOptionsWithOptionsForTesting(t)
+				executor := pool.NewFixedSizeExecutor(10, 50, _options...)
 				executor.Start()
 				transactionManager := transactions.NewRequestTransactionManager(
 					1,
-					options.WithCustomLogger(testutils.ProduceTestingLogger(t)),
-					transactions.WithCustomExecutor(executor),
+					append(_options,
+						transactions.WithCustomExecutor(executor),
+					)...,
 				)
 				t.Cleanup(func() {
 					assert.NoError(t, transactionManager.Close())
@@ -1677,12 +1684,14 @@ func TestMapEncodedReply(t *testing.T) {
 				},
 			},
 			setup: func(t *testing.T, args *args) {
-				executor := pool.NewFixedSizeExecutor(10, 50, options.WithCustomLogger(testutils.ProduceTestingLogger(t)))
+				_options := testutils.EnrichOptionsWithOptionsForTesting(t)
+				executor := pool.NewFixedSizeExecutor(10, 50, _options...)
 				executor.Start()
 				transactionManager := transactions.NewRequestTransactionManager(
 					1,
-					options.WithCustomLogger(testutils.ProduceTestingLogger(t)),
-					transactions.WithCustomExecutor(executor),
+					append(_options,
+						transactions.WithCustomExecutor(executor),
+					)...,
 				)
 				t.Cleanup(func() {
 					assert.NoError(t, transactionManager.Close())
@@ -1730,12 +1739,14 @@ func TestMapEncodedReply(t *testing.T) {
 				},
 			},
 			setup: func(t *testing.T, args *args) {
-				executor := pool.NewFixedSizeExecutor(10, 50, options.WithCustomLogger(testutils.ProduceTestingLogger(t)))
+				_options := testutils.EnrichOptionsWithOptionsForTesting(t)
+				executor := pool.NewFixedSizeExecutor(10, 50, _options...)
 				executor.Start()
 				transactionManager := transactions.NewRequestTransactionManager(
 					1,
-					options.WithCustomLogger(testutils.ProduceTestingLogger(t)),
-					transactions.WithCustomExecutor(executor),
+					append(_options,
+						transactions.WithCustomExecutor(executor),
+					)...,
 				)
 				t.Cleanup(func() {
 					assert.NoError(t, transactionManager.Close())
@@ -1786,12 +1797,14 @@ func TestMapEncodedReply(t *testing.T) {
 				},
 			},
 			setup: func(t *testing.T, args *args) {
-				executor := pool.NewFixedSizeExecutor(10, 50, options.WithCustomLogger(testutils.ProduceTestingLogger(t)))
+				_options := testutils.EnrichOptionsWithOptionsForTesting(t)
+				executor := pool.NewFixedSizeExecutor(10, 50, _options...)
 				executor.Start()
 				transactionManager := transactions.NewRequestTransactionManager(
 					1,
-					options.WithCustomLogger(testutils.ProduceTestingLogger(t)),
-					transactions.WithCustomExecutor(executor),
+					append(_options,
+						transactions.WithCustomExecutor(executor),
+					)...,
 				)
 				t.Cleanup(func() {
 					assert.NoError(t, transactionManager.Close())
@@ -1862,12 +1875,14 @@ func TestMapEncodedReply(t *testing.T) {
 				},
 			},
 			setup: func(t *testing.T, args *args) {
-				executor := pool.NewFixedSizeExecutor(10, 50, options.WithCustomLogger(testutils.ProduceTestingLogger(t)))
+				_options := testutils.EnrichOptionsWithOptionsForTesting(t)
+				executor := pool.NewFixedSizeExecutor(10, 50, _options...)
 				executor.Start()
 				transactionManager := transactions.NewRequestTransactionManager(
 					1,
-					options.WithCustomLogger(testutils.ProduceTestingLogger(t)),
-					transactions.WithCustomExecutor(executor),
+					append(_options,
+						transactions.WithCustomExecutor(executor),
+					)...,
 				)
 				t.Cleanup(func() {
 					assert.NoError(t, transactionManager.Close())
@@ -1956,12 +1971,14 @@ func TestMapEncodedReply(t *testing.T) {
 				},
 			},
 			setup: func(t *testing.T, args *args) {
-				executor := pool.NewFixedSizeExecutor(10, 50, options.WithCustomLogger(testutils.ProduceTestingLogger(t)))
+				_options := testutils.EnrichOptionsWithOptionsForTesting(t)
+				executor := pool.NewFixedSizeExecutor(10, 50, _options...)
 				executor.Start()
 				transactionManager := transactions.NewRequestTransactionManager(
 					1,
-					options.WithCustomLogger(testutils.ProduceTestingLogger(t)),
-					transactions.WithCustomExecutor(executor),
+					append(_options,
+						transactions.WithCustomExecutor(executor),
+					)...,
 				)
 				t.Cleanup(func() {
 					assert.NoError(t, transactionManager.Close())
@@ -2013,12 +2030,14 @@ func TestMapEncodedReply(t *testing.T) {
 				},
 			},
 			setup: func(t *testing.T, args *args) {
-				executor := pool.NewFixedSizeExecutor(10, 50, options.WithCustomLogger(testutils.ProduceTestingLogger(t)))
+				_options := testutils.EnrichOptionsWithOptionsForTesting(t)
+				executor := pool.NewFixedSizeExecutor(10, 50, _options...)
 				executor.Start()
 				transactionManager := transactions.NewRequestTransactionManager(
 					1,
-					options.WithCustomLogger(testutils.ProduceTestingLogger(t)),
-					transactions.WithCustomExecutor(executor),
+					append(_options,
+						transactions.WithCustomExecutor(executor),
+					)...,
 				)
 				t.Cleanup(func() {
 					assert.NoError(t, transactionManager.Close())
@@ -2066,12 +2085,14 @@ func TestMapEncodedReply(t *testing.T) {
 				},
 			},
 			setup: func(t *testing.T, args *args) {
-				executor := pool.NewFixedSizeExecutor(10, 50, options.WithCustomLogger(testutils.ProduceTestingLogger(t)))
+				_options := testutils.EnrichOptionsWithOptionsForTesting(t)
+				executor := pool.NewFixedSizeExecutor(10, 50, _options...)
 				executor.Start()
 				transactionManager := transactions.NewRequestTransactionManager(
 					1,
-					options.WithCustomLogger(testutils.ProduceTestingLogger(t)),
-					transactions.WithCustomExecutor(executor),
+					append(_options,
+						transactions.WithCustomExecutor(executor),
+					)...,
 				)
 				t.Cleanup(func() {
 					assert.NoError(t, transactionManager.Close())
@@ -2119,12 +2140,14 @@ func TestMapEncodedReply(t *testing.T) {
 				},
 			},
 			setup: func(t *testing.T, args *args) {
-				executor := pool.NewFixedSizeExecutor(10, 50, options.WithCustomLogger(testutils.ProduceTestingLogger(t)))
+				_options := testutils.EnrichOptionsWithOptionsForTesting(t)
+				executor := pool.NewFixedSizeExecutor(10, 50, _options...)
 				executor.Start()
 				transactionManager := transactions.NewRequestTransactionManager(
 					1,
-					options.WithCustomLogger(testutils.ProduceTestingLogger(t)),
-					transactions.WithCustomExecutor(executor),
+					append(_options,
+						transactions.WithCustomExecutor(executor),
+					)...,
 				)
 				t.Cleanup(func() {
 					assert.NoError(t, transactionManager.Close())
@@ -2172,12 +2195,14 @@ func TestMapEncodedReply(t *testing.T) {
 				},
 			},
 			setup: func(t *testing.T, args *args) {
-				executor := pool.NewFixedSizeExecutor(10, 50, options.WithCustomLogger(testutils.ProduceTestingLogger(t)))
+				_options := testutils.EnrichOptionsWithOptionsForTesting(t)
+				executor := pool.NewFixedSizeExecutor(10, 50, _options...)
 				executor.Start()
 				transactionManager := transactions.NewRequestTransactionManager(
 					1,
-					options.WithCustomLogger(testutils.ProduceTestingLogger(t)),
-					transactions.WithCustomExecutor(executor),
+					append(_options,
+						transactions.WithCustomExecutor(executor),
+					)...,
 				)
 				t.Cleanup(func() {
 					assert.NoError(t, transactionManager.Close())
@@ -2225,12 +2250,14 @@ func TestMapEncodedReply(t *testing.T) {
 				},
 			},
 			setup: func(t *testing.T, args *args) {
-				executor := pool.NewFixedSizeExecutor(10, 50, options.WithCustomLogger(testutils.ProduceTestingLogger(t)))
+				_options := testutils.EnrichOptionsWithOptionsForTesting(t)
+				executor := pool.NewFixedSizeExecutor(10, 50, _options...)
 				executor.Start()
 				transactionManager := transactions.NewRequestTransactionManager(
 					1,
-					options.WithCustomLogger(testutils.ProduceTestingLogger(t)),
-					transactions.WithCustomExecutor(executor),
+					append(_options,
+						transactions.WithCustomExecutor(executor),
+					)...,
 				)
 				t.Cleanup(func() {
 					assert.NoError(t, transactionManager.Close())
@@ -2298,12 +2325,14 @@ func TestMapEncodedReply(t *testing.T) {
 				},
 			},
 			setup: func(t *testing.T, args *args) {
-				executor := pool.NewFixedSizeExecutor(10, 50, options.WithCustomLogger(testutils.ProduceTestingLogger(t)))
+				_options := testutils.EnrichOptionsWithOptionsForTesting(t)
+				executor := pool.NewFixedSizeExecutor(10, 50, _options...)
 				executor.Start()
 				transactionManager := transactions.NewRequestTransactionManager(
 					1,
-					options.WithCustomLogger(testutils.ProduceTestingLogger(t)),
-					transactions.WithCustomExecutor(executor),
+					append(_options,
+						transactions.WithCustomExecutor(executor),
+					)...,
 				)
 				t.Cleanup(func() {
 					assert.NoError(t, transactionManager.Close())
@@ -2351,12 +2380,14 @@ func TestMapEncodedReply(t *testing.T) {
 				},
 			},
 			setup: func(t *testing.T, args *args) {
-				executor := pool.NewFixedSizeExecutor(10, 50, options.WithCustomLogger(testutils.ProduceTestingLogger(t)))
+				_options := testutils.EnrichOptionsWithOptionsForTesting(t)
+				executor := pool.NewFixedSizeExecutor(10, 50, _options...)
 				executor.Start()
 				transactionManager := transactions.NewRequestTransactionManager(
 					1,
-					options.WithCustomLogger(testutils.ProduceTestingLogger(t)),
-					transactions.WithCustomExecutor(executor),
+					append(_options,
+						transactions.WithCustomExecutor(executor),
+					)...,
 				)
 				t.Cleanup(func() {
 					assert.NoError(t, transactionManager.Close())
@@ -2404,12 +2435,14 @@ func TestMapEncodedReply(t *testing.T) {
 				},
 			},
 			setup: func(t *testing.T, args *args) {
-				executor := pool.NewFixedSizeExecutor(10, 50, options.WithCustomLogger(testutils.ProduceTestingLogger(t)))
+				_options := testutils.EnrichOptionsWithOptionsForTesting(t)
+				executor := pool.NewFixedSizeExecutor(10, 50, _options...)
 				executor.Start()
 				transactionManager := transactions.NewRequestTransactionManager(
 					1,
-					options.WithCustomLogger(testutils.ProduceTestingLogger(t)),
-					transactions.WithCustomExecutor(executor),
+					append(_options,
+						transactions.WithCustomExecutor(executor),
+					)...,
 				)
 				t.Cleanup(func() {
 					assert.NoError(t, transactionManager.Close())
@@ -2457,12 +2490,14 @@ func TestMapEncodedReply(t *testing.T) {
 				},
 			},
 			setup: func(t *testing.T, args *args) {
-				executor := pool.NewFixedSizeExecutor(10, 50, options.WithCustomLogger(testutils.ProduceTestingLogger(t)))
+				_options := testutils.EnrichOptionsWithOptionsForTesting(t)
+				executor := pool.NewFixedSizeExecutor(10, 50, _options...)
 				executor.Start()
 				transactionManager := transactions.NewRequestTransactionManager(
 					1,
-					options.WithCustomLogger(testutils.ProduceTestingLogger(t)),
-					transactions.WithCustomExecutor(executor),
+					append(_options,
+						transactions.WithCustomExecutor(executor),
+					)...,
 				)
 				t.Cleanup(func() {
 					assert.NoError(t, transactionManager.Close())
@@ -2510,12 +2545,14 @@ func TestMapEncodedReply(t *testing.T) {
 				},
 			},
 			setup: func(t *testing.T, args *args) {
-				executor := pool.NewFixedSizeExecutor(10, 50, options.WithCustomLogger(testutils.ProduceTestingLogger(t)))
+				_options := testutils.EnrichOptionsWithOptionsForTesting(t)
+				executor := pool.NewFixedSizeExecutor(10, 50, _options...)
 				executor.Start()
 				transactionManager := transactions.NewRequestTransactionManager(
 					1,
-					options.WithCustomLogger(testutils.ProduceTestingLogger(t)),
-					transactions.WithCustomExecutor(executor),
+					append(_options,
+						transactions.WithCustomExecutor(executor),
+					)...,
 				)
 				t.Cleanup(func() {
 					assert.NoError(t, transactionManager.Close())
@@ -2563,12 +2600,14 @@ func TestMapEncodedReply(t *testing.T) {
 				},
 			},
 			setup: func(t *testing.T, args *args) {
-				executor := pool.NewFixedSizeExecutor(10, 50, options.WithCustomLogger(testutils.ProduceTestingLogger(t)))
+				_options := testutils.EnrichOptionsWithOptionsForTesting(t)
+				executor := pool.NewFixedSizeExecutor(10, 50, _options...)
 				executor.Start()
 				transactionManager := transactions.NewRequestTransactionManager(
 					1,
-					options.WithCustomLogger(testutils.ProduceTestingLogger(t)),
-					transactions.WithCustomExecutor(executor),
+					append(_options,
+						transactions.WithCustomExecutor(executor),
+					)...,
 				)
 				t.Cleanup(func() {
 					assert.NoError(t, transactionManager.Close())
@@ -2632,12 +2671,14 @@ func TestMapEncodedReply(t *testing.T) {
 				},
 			},
 			setup: func(t *testing.T, args *args) {
-				executor := pool.NewFixedSizeExecutor(10, 50, options.WithCustomLogger(testutils.ProduceTestingLogger(t)))
+				_options := testutils.EnrichOptionsWithOptionsForTesting(t)
+				executor := pool.NewFixedSizeExecutor(10, 50, _options...)
 				executor.Start()
 				transactionManager := transactions.NewRequestTransactionManager(
 					1,
-					options.WithCustomLogger(testutils.ProduceTestingLogger(t)),
-					transactions.WithCustomExecutor(executor),
+					append(_options,
+						transactions.WithCustomExecutor(executor),
+					)...,
 				)
 				t.Cleanup(func() {
 					assert.NoError(t, transactionManager.Close())
@@ -2685,12 +2726,14 @@ func TestMapEncodedReply(t *testing.T) {
 				},
 			},
 			setup: func(t *testing.T, args *args) {
-				executor := pool.NewFixedSizeExecutor(10, 50, options.WithCustomLogger(testutils.ProduceTestingLogger(t)))
+				_options := testutils.EnrichOptionsWithOptionsForTesting(t)
+				executor := pool.NewFixedSizeExecutor(10, 50, _options...)
 				executor.Start()
 				transactionManager := transactions.NewRequestTransactionManager(
 					1,
-					options.WithCustomLogger(testutils.ProduceTestingLogger(t)),
-					transactions.WithCustomExecutor(executor),
+					append(_options,
+						transactions.WithCustomExecutor(executor),
+					)...,
 				)
 				t.Cleanup(func() {
 					assert.NoError(t, transactionManager.Close())
@@ -2738,12 +2781,14 @@ func TestMapEncodedReply(t *testing.T) {
 				},
 			},
 			setup: func(t *testing.T, args *args) {
-				executor := pool.NewFixedSizeExecutor(10, 50, options.WithCustomLogger(testutils.ProduceTestingLogger(t)))
+				_options := testutils.EnrichOptionsWithOptionsForTesting(t)
+				executor := pool.NewFixedSizeExecutor(10, 50, _options...)
 				executor.Start()
 				transactionManager := transactions.NewRequestTransactionManager(
 					1,
-					options.WithCustomLogger(testutils.ProduceTestingLogger(t)),
-					transactions.WithCustomExecutor(executor),
+					append(_options,
+						transactions.WithCustomExecutor(executor),
+					)...,
 				)
 				t.Cleanup(func() {
 					assert.NoError(t, transactionManager.Close())
diff --git a/plc4go/spi/pool/executor.go b/plc4go/spi/pool/executor.go
index 794bfb4221..403408f9ca 100644
--- a/plc4go/spi/pool/executor.go
+++ b/plc4go/spi/pool/executor.go
@@ -92,11 +92,13 @@ func (e *executor) Start() {
 	}
 	e.running = true
 	e.shutdown = false
+	e.log.Debug().Msgf("Starting %d workers", len(e.worker))
 	for i := 0; i < len(e.worker); i++ {
 		_worker := e.worker[i]
 		_worker.initialize()
 		_worker.start()
 	}
+	e.log.Trace().Msg("started")
 }
 
 func (e *executor) Stop() {
diff --git a/plc4go/spi/pool/worker.go b/plc4go/spi/pool/worker.go
index 6017f6c78c..f58e8dcbde 100644
--- a/plc4go/spi/pool/worker.go
+++ b/plc4go/spi/pool/worker.go
@@ -50,23 +50,27 @@ type worker struct {
 }
 
 func (w *worker) initialize() {
+	w.stateChange.Lock()
+	defer w.stateChange.Unlock()
+	w.lastReceived.Store(time.Now())
+	w.running.Store(false)
 	w.shutdown.Store(false)
 	w.interrupted.Store(false)
 	w.interrupter = make(chan struct{}, 1)
-	w.lastReceived.Store(time.Now())
 }
 
 func (w *worker) start() {
 	w.stateChange.Lock()
 	defer w.stateChange.Unlock()
 	if w.running.Load() {
-		log.Warn().Msg("Worker already started")
+		log.Warn().Int("Worker id", w.id).Msg("Worker already started")
 		return
 	}
 	if w.executor.isTraceWorkers() {
 		w.log.Debug().Msgf("Starting worker\n%s", w)
 	}
 	w.executor.getWorkerWaitGroup().Add(1)
+	w.running.Store(true)
 	go w.work()
 }
 
@@ -74,9 +78,13 @@ func (w *worker) stop(interrupt bool) {
 	w.stateChange.Lock()
 	defer w.stateChange.Unlock()
 	if !w.running.Load() {
-		w.log.Warn().Msg("Worker not running")
+		w.log.Warn().Int("Worker id", w.id).Msg("Worker not running")
 		return
 	}
+
+	if w.executor.isTraceWorkers() {
+		w.log.Debug().Msgf("Stopping worker\n%s", w)
+	}
 	w.shutdown.Store(true)
 	if interrupt {
 		w.interrupted.Store(true)
@@ -95,7 +103,6 @@ func (w *worker) work() {
 			}
 		}
 	}()
-	w.running.Store(true)
 	defer w.running.Store(false)
 	workerLog := w.log.With().Int("Worker id", w.id).Logger()
 	if !w.executor.isTraceWorkers() {
diff --git a/plc4go/spi/pool/worker_test.go b/plc4go/spi/pool/worker_test.go
index d781466b43..7e24fd4077 100644
--- a/plc4go/spi/pool/worker_test.go
+++ b/plc4go/spi/pool/worker_test.go
@@ -82,24 +82,38 @@ func Test_worker_start(t *testing.T) {
 			fields: fields{
 				executor: func() *executor {
 					e := &executor{
-						workItems:    make(chan workItem),
+						workItems:    make(chan workItem, 1),
 						traceWorkers: true,
 					}
-					go func() {
-						e.workItems <- workItem{
-							workItemId: 0,
-							runnable: func() {
-								// No-op
-							},
-							completionFuture: &future{},
-						}
-					}()
+					e.workItems <- workItem{
+						workItemId: 0,
+						runnable: func() {
+							// No-op
+						},
+						completionFuture: &future{},
+					}
 					return e
 				}(),
 			},
 		},
 		{
 			name: "start started",
+			fields: fields{
+				executor: func() *executor {
+					e := &executor{
+						workItems:    make(chan workItem, 1),
+						traceWorkers: true,
+					}
+					e.workItems <- workItem{
+						workItemId: 0,
+						runnable: func() {
+							// No-op
+						},
+						completionFuture: &future{},
+					}
+					return e
+				}(),
+			},
 			manipulator: func(t *testing.T, worker *worker) {
 				worker.running.Store(true)
 			},
@@ -149,6 +163,22 @@ func Test_worker_stop(t *testing.T) {
 			name: "stop started",
 			fields: fields{
 				interrupter: make(chan struct{}),
+				executor: func() *executor {
+					e := &executor{
+						workItems:    make(chan workItem),
+						traceWorkers: true,
+					}
+					go func() {
+						e.workItems <- workItem{
+							workItemId: 0,
+							runnable: func() {
+								// No-op
+							},
+							completionFuture: &future{},
+						}
+					}()
+					return e
+				}(),
 			},
 			manipulator: func(t *testing.T, worker *worker) {
 				worker.running.Store(true)
@@ -318,6 +348,7 @@ func Test_worker_work(t *testing.T) {
 				log:         produceTestingLogger(t),
 			}
 			w.executor.getWorkerWaitGroup().Add(1)
+			w.running.Store(true)
 			go w.work()
 			if tt.firstValidation != nil {
 				time.Sleep(tt.timeBeforeFirstValidation)


[plc4x] 01/05: feat(plc4go/bacnet): update vendor

Posted by sr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 405c8f83edd2c6fd6906c42beceb8882a2450088
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Mon Jun 19 18:21:36 2023 +0200

    feat(plc4go/bacnet): update vendor
---
 .../bacnetip/readwrite/model/BACnetVendorId.go     | 48 ++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetVendorId.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetVendorId.go
index 38b95e59d2..6bbf12f5be 100644
--- a/plc4go/protocols/bacnetip/readwrite/model/BACnetVendorId.go
+++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetVendorId.go
@@ -1457,6 +1457,9 @@ const (
 	BACnetVendorId_UBIQISENSE_APS                                                               BACnetVendorId = 1420
 	BACnetVendorId_TIGER_SOFT                                                                   BACnetVendorId = 1421
 	BACnetVendorId_ECODOM_SRL                                                                   BACnetVendorId = 1422
+	BACnetVendorId_DOLPHIN_SOLUTIONS_LTD                                                        BACnetVendorId = 1425
+	BACnetVendorId_MITSUBISHI_ELECTRIC_CORPORATION                                              BACnetVendorId = 1426
+	BACnetVendorId_ECOVENA                                                                      BACnetVendorId = 1427
 	BACnetVendorId_UNKNOWN_VENDOR                                                               BACnetVendorId = 0xFFFF
 )
 
@@ -2879,6 +2882,9 @@ func init() {
 		BACnetVendorId_UBIQISENSE_APS,
 		BACnetVendorId_TIGER_SOFT,
 		BACnetVendorId_ECODOM_SRL,
+		BACnetVendorId_DOLPHIN_SOLUTIONS_LTD,
+		BACnetVendorId_MITSUBISHI_ELECTRIC_CORPORATION,
+		BACnetVendorId_ECOVENA,
 		BACnetVendorId_UNKNOWN_VENDOR,
 	}
 }
@@ -4769,6 +4775,18 @@ func (e BACnetVendorId) VendorId() uint16 {
 		{ /* '1422' */
 			return 1422
 		}
+	case 1425:
+		{ /* '1425' */
+			return 1425
+		}
+	case 1426:
+		{ /* '1426' */
+			return 1426
+		}
+	case 1427:
+		{ /* '1427' */
+			return 1427
+		}
 	case 143:
 		{ /* '143' */
 			return 143
@@ -10447,6 +10465,18 @@ func (e BACnetVendorId) VendorName() string {
 		{ /* '1422' */
 			return "Ecodom Srl"
 		}
+	case 1425:
+		{ /* '1425' */
+			return "Dolphin Solutions Ltd"
+		}
+	case 1426:
+		{ /* '1426' */
+			return "Mitsubishi Electric Corporation"
+		}
+	case 1427:
+		{ /* '1427' */
+			return "Ecovena"
+		}
 	case 143:
 		{ /* '143' */
 			return "Digitale Mess- und Steuersysteme AG"
@@ -15182,6 +15212,12 @@ func BACnetVendorIdByValue(value uint16) (enum BACnetVendorId, ok bool) {
 		return BACnetVendorId_TIGER_SOFT, true
 	case 1422:
 		return BACnetVendorId_ECODOM_SRL, true
+	case 1425:
+		return BACnetVendorId_DOLPHIN_SOLUTIONS_LTD, true
+	case 1426:
+		return BACnetVendorId_MITSUBISHI_ELECTRIC_CORPORATION, true
+	case 1427:
+		return BACnetVendorId_ECOVENA, true
 	case 143:
 		return BACnetVendorId_DIGITALE_MESSUND_STEUERSYSTEMEAG, true
 	case 144:
@@ -18018,6 +18054,12 @@ func BACnetVendorIdByName(value string) (enum BACnetVendorId, ok bool) {
 		return BACnetVendorId_TIGER_SOFT, true
 	case "ECODOM_SRL":
 		return BACnetVendorId_ECODOM_SRL, true
+	case "DOLPHIN_SOLUTIONS_LTD":
+		return BACnetVendorId_DOLPHIN_SOLUTIONS_LTD, true
+	case "MITSUBISHI_ELECTRIC_CORPORATION":
+		return BACnetVendorId_MITSUBISHI_ELECTRIC_CORPORATION, true
+	case "ECOVENA":
+		return BACnetVendorId_ECOVENA, true
 	case "DIGITALE_MESSUND_STEUERSYSTEMEAG":
 		return BACnetVendorId_DIGITALE_MESSUND_STEUERSYSTEMEAG, true
 	case "FUJITSU_GENERAL_LIMITED":
@@ -20915,6 +20957,12 @@ func (e BACnetVendorId) PLC4XEnumName() string {
 		return "TIGER_SOFT"
 	case BACnetVendorId_ECODOM_SRL:
 		return "ECODOM_SRL"
+	case BACnetVendorId_DOLPHIN_SOLUTIONS_LTD:
+		return "DOLPHIN_SOLUTIONS_LTD"
+	case BACnetVendorId_MITSUBISHI_ELECTRIC_CORPORATION:
+		return "MITSUBISHI_ELECTRIC_CORPORATION"
+	case BACnetVendorId_ECOVENA:
+		return "ECOVENA"
 	case BACnetVendorId_DIGITALE_MESSUND_STEUERSYSTEMEAG:
 		return "DIGITALE_MESSUND_STEUERSYSTEMEAG"
 	case BACnetVendorId_FUJITSU_GENERAL_LIMITED:


[plc4x] 04/05: feat(plc4j/bacnet): update vendor

Posted by sr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit fa268e8586075cbe79605af69f445023032049bc
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Mon Jun 19 18:51:29 2023 +0200

    feat(plc4j/bacnet): update vendor
---
 .../org/apache/plc4x/java/bacnetip/readwrite/BACnetVendorId.java      | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/plc4j/drivers/bacnet/src/main/generated/org/apache/plc4x/java/bacnetip/readwrite/BACnetVendorId.java b/plc4j/drivers/bacnet/src/main/generated/org/apache/plc4x/java/bacnetip/readwrite/BACnetVendorId.java
index 0e4d894f40..128d8848b5 100644
--- a/plc4j/drivers/bacnet/src/main/generated/org/apache/plc4x/java/bacnetip/readwrite/BACnetVendorId.java
+++ b/plc4j/drivers/bacnet/src/main/generated/org/apache/plc4x/java/bacnetip/readwrite/BACnetVendorId.java
@@ -1632,6 +1632,10 @@ public enum BACnetVendorId {
   UBIQISENSE_APS((int) 1420, (int) 1420, (String) "Ubiqisense ApS"),
   TIGER_SOFT((int) 1421, (int) 1421, (String) "Tiger-Soft"),
   ECODOM_SRL((int) 1422, (int) 1422, (String) "Ecodom Srl"),
+  DOLPHIN_SOLUTIONS_LTD((int) 1425, (int) 1425, (String) "Dolphin Solutions Ltd"),
+  MITSUBISHI_ELECTRIC_CORPORATION(
+      (int) 1426, (int) 1426, (String) "Mitsubishi Electric Corporation"),
+  ECOVENA((int) 1427, (int) 1427, (String) "Ecovena"),
   UNKNOWN_VENDOR((int) 0xFFFF, (int) 0xFFFF, (String) "Unknown");
   private static final Map<Integer, BACnetVendorId> map;
 


[plc4x] 03/05: feat(plc4j/knx): update vendor

Posted by sr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 50184f67470f2e82d411a5e6b5a1e87dc89a70a8
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Mon Jun 19 18:51:21 2023 +0200

    feat(plc4j/knx): update vendor
---
 .../org/apache/plc4x/java/knxnetip/readwrite/KnxManufacturer.java   | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/plc4j/drivers/knxnetip/src/main/generated/org/apache/plc4x/java/knxnetip/readwrite/KnxManufacturer.java b/plc4j/drivers/knxnetip/src/main/generated/org/apache/plc4x/java/knxnetip/readwrite/KnxManufacturer.java
index 4fa19d0ada..d06093f11f 100644
--- a/plc4j/drivers/knxnetip/src/main/generated/org/apache/plc4x/java/knxnetip/readwrite/KnxManufacturer.java
+++ b/plc4j/drivers/knxnetip/src/main/generated/org/apache/plc4x/java/knxnetip/readwrite/KnxManufacturer.java
@@ -728,9 +728,11 @@ public enum KnxManufacturer {
   M_PAYNE_TECHNOLOGIES_LTD((int) 632, (int) 689, (String) "Payne Technologies Ltd"),
   M_GUANGDONG_YOZEWIT_INTELLIGENT_TECHNOLOGY_CO__LTD_(
       (int) 633, (int) 690, (String) "Guangdong Yozewit Intelligent Technology Co.,Ltd."),
-  M_ABB___RESERVED((int) 634, (int) 43954, (String) "ABB - reserved"),
+  M_SEXANKA((int) 634, (int) 691, (String) "SEXANKA"),
+  M_SECURI_FLEX_LTD((int) 635, (int) 692, (String) "Securi-Flex Ltd"),
+  M_ABB___RESERVED((int) 636, (int) 43954, (String) "ABB - reserved"),
   M_BUSCH_JAEGER_ELEKTRO___RESERVED(
-      (int) 635, (int) 43959, (String) "Busch-Jaeger Elektro - reserved");
+      (int) 637, (int) 43959, (String) "Busch-Jaeger Elektro - reserved");
   private static final Map<Integer, KnxManufacturer> map;
 
   static {


[plc4x] 02/05: feat(plc4go/knx): update vendor

Posted by sr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 9fe80f9cfea910bfffdda124227c48ee9347d51a
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Mon Jun 19 18:21:41 2023 +0200

    feat(plc4go/knx): update vendor
---
 .../knxnetip/readwrite/model/KnxManufacturer.go    | 42 +++++++++++++++++++---
 1 file changed, 37 insertions(+), 5 deletions(-)

diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxManufacturer.go b/plc4go/protocols/knxnetip/readwrite/model/KnxManufacturer.go
index 375fdd0d24..eeba3de6b6 100644
--- a/plc4go/protocols/knxnetip/readwrite/model/KnxManufacturer.go
+++ b/plc4go/protocols/knxnetip/readwrite/model/KnxManufacturer.go
@@ -677,8 +677,10 @@ const (
 	KnxManufacturer_M_PASSIV_ENERGIE_GMBH                                KnxManufacturer = 631
 	KnxManufacturer_M_PAYNE_TECHNOLOGIES_LTD                             KnxManufacturer = 632
 	KnxManufacturer_M_GUANGDONG_YOZEWIT_INTELLIGENT_TECHNOLOGY_CO__LTD_  KnxManufacturer = 633
-	KnxManufacturer_M_ABB___RESERVED                                     KnxManufacturer = 634
-	KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO___RESERVED                    KnxManufacturer = 635
+	KnxManufacturer_M_SEXANKA                                            KnxManufacturer = 634
+	KnxManufacturer_M_SECURI_FLEX_LTD                                    KnxManufacturer = 635
+	KnxManufacturer_M_ABB___RESERVED                                     KnxManufacturer = 636
+	KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO___RESERVED                    KnxManufacturer = 637
 )
 
 var KnxManufacturerValues []KnxManufacturer
@@ -1320,6 +1322,8 @@ func init() {
 		KnxManufacturer_M_PASSIV_ENERGIE_GMBH,
 		KnxManufacturer_M_PAYNE_TECHNOLOGIES_LTD,
 		KnxManufacturer_M_GUANGDONG_YOZEWIT_INTELLIGENT_TECHNOLOGY_CO__LTD_,
+		KnxManufacturer_M_SEXANKA,
+		KnxManufacturer_M_SECURI_FLEX_LTD,
 		KnxManufacturer_M_ABB___RESERVED,
 		KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO___RESERVED,
 	}
@@ -3709,10 +3713,18 @@ func (e KnxManufacturer) Number() uint16 {
 		}
 	case 634:
 		{ /* '634' */
-			return 43954
+			return 691
 		}
 	case 635:
 		{ /* '635' */
+			return 692
+		}
+	case 636:
+		{ /* '636' */
+			return 43954
+		}
+	case 637:
+		{ /* '637' */
 			return 43959
 		}
 	case 64:
@@ -6271,10 +6283,18 @@ func (e KnxManufacturer) Name() string {
 		}
 	case 634:
 		{ /* '634' */
-			return "ABB - reserved"
+			return "SEXANKA"
 		}
 	case 635:
 		{ /* '635' */
+			return "Securi-Flex Ltd"
+		}
+	case 636:
+		{ /* '636' */
+			return "ABB - reserved"
+		}
+	case 637:
+		{ /* '637' */
 			return "Busch-Jaeger Elektro - reserved"
 		}
 	case 64:
@@ -7641,8 +7661,12 @@ func KnxManufacturerByValue(value uint16) (enum KnxManufacturer, ok bool) {
 	case 633:
 		return KnxManufacturer_M_GUANGDONG_YOZEWIT_INTELLIGENT_TECHNOLOGY_CO__LTD_, true
 	case 634:
-		return KnxManufacturer_M_ABB___RESERVED, true
+		return KnxManufacturer_M_SEXANKA, true
 	case 635:
+		return KnxManufacturer_M_SECURI_FLEX_LTD, true
+	case 636:
+		return KnxManufacturer_M_ABB___RESERVED, true
+	case 637:
 		return KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO___RESERVED, true
 	case 64:
 		return KnxManufacturer_M_BISCHOFF_ELEKTRONIK, true
@@ -8918,6 +8942,10 @@ func KnxManufacturerByName(value string) (enum KnxManufacturer, ok bool) {
 		return KnxManufacturer_M_PAYNE_TECHNOLOGIES_LTD, true
 	case "M_GUANGDONG_YOZEWIT_INTELLIGENT_TECHNOLOGY_CO__LTD_":
 		return KnxManufacturer_M_GUANGDONG_YOZEWIT_INTELLIGENT_TECHNOLOGY_CO__LTD_, true
+	case "M_SEXANKA":
+		return KnxManufacturer_M_SEXANKA, true
+	case "M_SECURI_FLEX_LTD":
+		return KnxManufacturer_M_SECURI_FLEX_LTD, true
 	case "M_ABB___RESERVED":
 		return KnxManufacturer_M_ABB___RESERVED, true
 	case "M_BUSCH_JAEGER_ELEKTRO___RESERVED":
@@ -10257,6 +10285,10 @@ func (e KnxManufacturer) PLC4XEnumName() string {
 		return "M_PAYNE_TECHNOLOGIES_LTD"
 	case KnxManufacturer_M_GUANGDONG_YOZEWIT_INTELLIGENT_TECHNOLOGY_CO__LTD_:
 		return "M_GUANGDONG_YOZEWIT_INTELLIGENT_TECHNOLOGY_CO__LTD_"
+	case KnxManufacturer_M_SEXANKA:
+		return "M_SEXANKA"
+	case KnxManufacturer_M_SECURI_FLEX_LTD:
+		return "M_SECURI_FLEX_LTD"
 	case KnxManufacturer_M_ABB___RESERVED:
 		return "M_ABB___RESERVED"
 	case KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO___RESERVED: